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.
This commit is contained in:
Ján Tomko 2014-03-20 13:08:49 +01:00
parent cf4fb7d9a0
commit d223cd76c3

View File

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