diff options
author | Karel Zak | 2015-08-31 10:11:01 +0200 |
---|---|---|
committer | Karel Zak | 2015-08-31 10:11:01 +0200 |
commit | 32c9ce4bafa76003f732b6e60e794c15a1942ca8 (patch) | |
tree | 93db5c8d8b2ae63110a9bcaa34967b0b8c87ec3c /lib/sysfs.c | |
parent | lsblk: fix resource leak [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-32c9ce4bafa76003f732b6e60e794c15a1942ca8.tar.gz kernel-qcow2-util-linux-32c9ce4bafa76003f732b6e60e794c15a1942ca8.tar.xz kernel-qcow2-util-linux-32c9ce4bafa76003f732b6e60e794c15a1942ca8.zip |
lib/sysfs: make sysfs_next_subsystem() more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r-- | lib/sysfs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c index caf89bf53..d2146d5fb 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -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) |