lib/strutil: fix parse_switch resource leak [coverity scan]

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
This commit is contained in:
Andreas Henriksson 2015-08-25 18:27:40 +02:00 committed by Karel Zak
parent 9c9ebb988e
commit 74819b5f64
1 changed files with 5 additions and 2 deletions

View File

@ -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);