lib/sysfs: make sysfs_next_subsystem() more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2015-08-31 10:11:01 +02:00
parent 56e78cb532
commit 32c9ce4baf

View file

@ -658,6 +658,8 @@ int sysfs_next_subsystem(struct sysfs_cxt *cxt __attribute__((unused)),
if (!subsys || !devchain)
return -EINVAL;
*subsys = NULL;
while ((sub = get_subsystem(devchain, subbuf, sizeof(subbuf)))) {
*subsys = strdup(sub);
if (!*subsys)