]> xenbits.xensource.com Git - libvirt.git/commit
util: Avoid double free in virProcessSetAffinity
authorMartin Kletzander <mkletzan@redhat.com>
Tue, 27 Oct 2020 12:48:38 +0000 (13:48 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 27 Oct 2020 15:37:43 +0000 (16:37 +0100)
commit1f807631f402210d036ec4803e7adfefa222f786
treedc790c211a677ff30ed2f1f0e28dd9eeb63ebc51
parentbcdb089ef975d8303c56dd061f272e44f6ae29c7
util: Avoid double free in virProcessSetAffinity

The cpu mask was free()'d immediately on any error and at the end of the
function, where it was expected that it would either error out and return or
goto another allocation if the code was to fail.  However since commit
9514e24984ee the error path did not return in one new case which caused
double-free in such situation.  In order to make the code more straightforward
just free the mask after it's been used even before checking the return code of
the call.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1819801

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/virprocess.c