Fixing memory leak shown by valgrind and freeing buffer in two more
places.
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
Index: libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_ebiptables_driver.c
+++ libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -1508,7 +1508,11 @@ _iptablesCreateRuleInstance(int directio
}
if (virBufferUse(&prefix)) {
- virBufferVSprintf(&prefix, "%s",
virBufferContentAndReset(&buf));
+ char *s = virBufferContentAndReset(&buf);
+
+ virBufferVSprintf(&prefix, "%s", s);
+
+ VIR_FREE(s);
final = &prefix;
@@ -1531,11 +1535,13 @@ _iptablesCreateRuleInstance(int directio
err_exit:
virBufferFreeAndReset(&buf);
+ virBufferFreeAndReset(&prefix);
return -1;
exit_no_error:
virBufferFreeAndReset(&buf);
+ virBufferFreeAndReset(&prefix);
return 0;
}