From d564fcb3e1439f21f5c951061e483bb9a08c2b69 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 18 May 2010 14:42:33 +0200 Subject: [PATCH] ebtablesAddRemoveRule, iptablesAddRemoveRule: don't skip va_end * src/util/ebtables.c (ebtablesAddRemoveRule): Don't skip va_end(args) on an error path. * src/util/iptables.c (iptablesAddRemoveRule): Identical change. --- src/util/ebtables.c | 7 +++++-- src/util/iptables.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/util/ebtables.c b/src/util/ebtables.c index e2b96085e6..f707756e4b 100644 --- a/src/util/ebtables.c +++ b/src/util/ebtables.c @@ -210,9 +210,12 @@ ebtablesAddRemoveRule(ebtRules *rules, int action, const char *arg, ...) va_start(args, arg); - while ((s = va_arg(args, const char *))) - if (!(argv[n++] = strdup(s))) + while ((s = va_arg(args, const char *))) { + if (!(argv[n++] = strdup(s))) { + va_end(args); goto error; + } + } va_end(args); diff --git a/src/util/iptables.c b/src/util/iptables.c index 4f95a02a1b..d06b857f9f 100644 --- a/src/util/iptables.c +++ b/src/util/iptables.c @@ -137,9 +137,12 @@ iptablesAddRemoveRule(iptRules *rules, int action, const char *arg, ...) va_start(args, arg); - while ((s = va_arg(args, const char *))) - if (!(argv[n++] = strdup(s))) + while ((s = va_arg(args, const char *))) { + if (!(argv[n++] = strdup(s))) { + va_end(args); goto error; + } + } va_end(args); -- GitLab