From: Andreas Henriksson <andreas@fatal.se>
To: util-linux@vger.kernel.org
Cc: Andreas Henriksson <andreas@fatal.se>
Subject: [PATCH 2/2] lsblk: fix resource leak [coverity scan]
Date: Tue, 25 Aug 2015 18:27:41 +0200 [thread overview]
Message-ID: <1440520061-23922-2-git-send-email-andreas@fatal.se> (raw)
In-Reply-To: <1440520061-23922-1-git-send-email-andreas@fatal.se>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
misc-utils/lsblk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 4cfeef8..d1bb13a 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);
--
2.1.4
next prev parent reply other threads:[~2015-08-25 16:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 16:27 [PATCH 1/2] lib/strutil: fix parse_switch resource leak [coverity scan] Andreas Henriksson
2015-08-25 16:27 ` Andreas Henriksson [this message]
2015-08-31 8:11 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440520061-23922-2-git-send-email-andreas@fatal.se \
--to=andreas@fatal.se \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox