mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
nwfilter: fix memory leaks
Fixing memory leak shown by valgrind and freeing buffer in two more places.
This commit is contained in:
parent
02e11b8353
commit
2e224f197c
@ -1508,7 +1508,11 @@ _iptablesCreateRuleInstance(int directionIn,
|
||||
}
|
||||
|
||||
if (virBufferUse(&prefix)) {
|
||||
virBufferVSprintf(&prefix, "%s", virBufferContentAndReset(&buf));
|
||||
char *s = virBufferContentAndReset(&buf);
|
||||
|
||||
virBufferAdd(&prefix, s, -1);
|
||||
|
||||
VIR_FREE(s);
|
||||
|
||||
final = &prefix;
|
||||
|
||||
@ -1531,11 +1535,13 @@ _iptablesCreateRuleInstance(int directionIn,
|
||||
|
||||
err_exit:
|
||||
virBufferFreeAndReset(&buf);
|
||||
virBufferFreeAndReset(&prefix);
|
||||
|
||||
return -1;
|
||||
|
||||
exit_no_error:
|
||||
virBufferFreeAndReset(&buf);
|
||||
virBufferFreeAndReset(&prefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user