lib/strutil: fix parse_switch resource leak [coverity scan]
Subsystems (2)
PATCH 1/2 lib/strutil: fix parse_switch resource leak [coverity scan]
Signed-off-by Andreas Henriksson <[email protected]>
--- lib/strutils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
lib/strutils.c +5 -2
@@ -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);
Signature · 1 line
2.1.4
PATCH 2/2 lsblk: fix resource leak [coverity scan]
Signed-off-by Andreas Henriksson <[email protected]>
--- misc-utils/lsblk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
misc-utils/lsblk.c +3 -1
@@ -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 );
Signature · 1 line
2.1.4
Karel Zak
maintainerQuoted 2 lines · Andreas Henriksson
lib/strutils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Applied (both patches), thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com