summaryrefslogtreecommitdiffstats
path: root/lib/strutils.c
diff options
context:
space:
mode:
authorAndreas Henriksson2015-08-25 18:27:40 +0200
committerKarel Zak2015-08-31 10:09:43 +0200
commit74819b5f6421cb06029e8355ea8b06190be9b7c1 (patch)
treedb9341502a884a9002c5d784fb83b7d9f764039c /lib/strutils.c
parentMerge branch 'escaped-test' of https://github.com/kees/util-linux (diff)
downloadkernel-qcow2-util-linux-74819b5f6421cb06029e8355ea8b06190be9b7c1.tar.gz
kernel-qcow2-util-linux-74819b5f6421cb06029e8355ea8b06190be9b7c1.tar.xz
kernel-qcow2-util-linux-74819b5f6421cb06029e8355ea8b06190be9b7c1.zip
lib/strutil: fix parse_switch resource leak [coverity scan]
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Diffstat (limited to 'lib/strutils.c')
-rw-r--r--lib/strutils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/strutils.c b/lib/strutils.c
index b033f7592..30dc090b4 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);