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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andreas Henriksson <andreas@xxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux