From d223cd76c321c58c834dd642eba6fec46ba14a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Thu, 20 Mar 2014 13:08:49 +0100 Subject: Free groups in case of a partial match If there are more than two regexes, but only one of them matches, the matched groups would be leaked. --- src/util/vircommand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 8a28813352..acf63b320e 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2858,10 +2858,10 @@ virCommandRunRegex(virCommandPtr cmd, if (i == nregex) { if (((*func)(groups, data)) < 0) goto cleanup; - - for (j = 0; j < totgroups; j++) - VIR_FREE(groups[j]); } + + for (j = 0; j < ngroup; j++) + VIR_FREE(groups[j]); } ret = 0; -- cgit v1.2.1