lib/path: fix possible NULL dereferencing [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
8e28151329
commit
8083862536
|
@ -570,10 +570,12 @@ int ul_path_read_string(struct path_cxt *pc, char **str, const char *path)
|
|||
char buf[BUFSIZ];
|
||||
int rc;
|
||||
|
||||
*str = NULL;
|
||||
if (!str)
|
||||
return -EINVAL;
|
||||
|
||||
*str = NULL;
|
||||
rc = ul_path_read(pc, buf, sizeof(buf) - 1, path);
|
||||
if (rc < 0 || !str)
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
/* Remove tailing newline (usual in sysfs) */
|
||||
|
|
Loading…
Reference in New Issue