]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virNWFilterIncludeDefToRuleInst: Refactor cleanup
authorPeter Krempa <pkrempa@redhat.com>
Wed, 4 Aug 2021 09:28:35 +0000 (11:28 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 6 Aug 2021 06:53:26 +0000 (08:53 +0200)
commit0b6888451feb216c74393982968460328d7db6b7
tree2e24fb09d2fc23426ddde8061d0570cf03487d99
parentabd045030e1ae23fd2ceb09e393d9e8f8ee725da
virNWFilterIncludeDefToRuleInst: Refactor cleanup

Use automatic memory freeing for 'tmpvars' and move the allocation of
tmpvars earlier so that we are guaranteed that 'obj' will always be
appended to 'inst->filters' and thus don't need cleanup for it.

By moving the reset of 'inst' to the block when virNWFilterDefToInst
fails we can get rid of the rest of the cleanup section and remove the
'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/nwfilter/nwfilter_gentech_driver.c