diff options
author | Andreas Henriksson | 2015-08-25 18:27:41 +0200 |
---|---|---|
committer | Karel Zak | 2015-08-31 10:09:45 +0200 |
commit | 56e78cb53252a983f6614f4bfd89e5e696e2a2f1 (patch) | |
tree | 721bd04ec1500ca24d838686bcf79f8c9077cd7e /misc-utils | |
parent | lib/strutil: fix parse_switch resource leak [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-56e78cb53252a983f6614f4bfd89e5e696e2a2f1.tar.gz kernel-qcow2-util-linux-56e78cb53252a983f6614f4bfd89e5e696e2a2f1.tar.xz kernel-qcow2-util-linux-56e78cb53252a983f6614f4bfd89e5e696e2a2f1.zip |
lsblk: fix resource leak [coverity scan]
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Diffstat (limited to 'misc-utils')
-rw-r--r-- | misc-utils/lsblk.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 4cfeef890..d1bb13a54 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -762,8 +762,10 @@ static char *get_subsystems(struct blkdev_cxt *cxt) size_t sz; /* don't create "block:scsi:scsi", but "block:scsi" */ - if (len && strcmp(res + last, sub) == 0) + if (len && strcmp(res + last, sub) == 0) { + free(sub); continue; + } sz = strlen(sub); res = xrealloc(res, len + sz + 2); |