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 c17792b..fab3aba 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; -- 1.8.3.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list