* [PATCH 1/2] lib/strutil: fix parse_switch resource leak [coverity scan]
@ 2015-08-25 16:27 Andreas Henriksson
2015-08-25 16:27 ` [PATCH 2/2] lsblk: fix " Andreas Henriksson
2015-08-31 8:11 ` [PATCH 1/2] lib/strutil: fix parse_switch " Karel Zak
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Henriksson @ 2015-08-25 16:27 UTC (permalink / raw)
To: util-linux; +Cc: Andreas Henriksson
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
lib/strutils.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/strutils.c b/lib/strutils.c
index b033f75..30dc090 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -198,10 +198,13 @@ int parse_switch(const char *arg, const char *errmesg, ...)
if (!b)
break;
- if (strcmp(arg, a) == 0)
+ if (strcmp(arg, a) == 0) {
+ va_end(ap);
return 1;
- else if (strcmp(arg, b) == 0)
+ } else if (strcmp(arg, b) == 0) {
+ va_end(ap);
return 0;
+ }
} while (1);
va_end(ap);
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] lsblk: fix resource leak [coverity scan]
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
2015-08-31 8:11 ` [PATCH 1/2] lib/strutil: fix parse_switch " Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Henriksson @ 2015-08-25 16:27 UTC (permalink / raw)
To: util-linux; +Cc: Andreas Henriksson
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] lib/strutil: fix parse_switch resource leak [coverity scan]
2015-08-25 16:27 [PATCH 1/2] lib/strutil: fix parse_switch resource leak [coverity scan] Andreas Henriksson
2015-08-25 16:27 ` [PATCH 2/2] lsblk: fix " Andreas Henriksson
@ 2015-08-31 8:11 ` Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2015-08-31 8:11 UTC (permalink / raw)
To: Andreas Henriksson; +Cc: util-linux
On Tue, Aug 25, 2015 at 06:27:40PM +0200, Andreas Henriksson wrote:
> lib/strutils.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
Applied (both patches), thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-31 8:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 16:27 [PATCH 1/2] lib/strutil: fix parse_switch resource leak [coverity scan] Andreas Henriksson
2015-08-25 16:27 ` [PATCH 2/2] lsblk: fix " Andreas Henriksson
2015-08-31 8:11 ` [PATCH 1/2] lib/strutil: fix parse_switch " Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox