diff options
author | Ján Tomko <jtomko@redhat.com> | 2014-03-20 13:08:49 +0100 |
---|---|---|
committer | Ján Tomko <jtomko@redhat.com> | 2014-03-26 15:06:10 +0100 |
commit | d223cd76c321c58c834dd642eba6fec46ba14a5a (patch) | |
tree | dc1dde9abe6947c19f4ca22540c1851455100727 | |
parent | cf4fb7d9a054bf87463b4ef6b221b36de7dc0a0f (diff) | |
download | libvirt-d223cd76c321c58c834dd642eba6fec46ba14a5a.tar.gz |
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.
-rw-r--r-- | src/util/vircommand.c | 6 |
1 files 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; |