[PATCH] util: Avoid double free in virProcessSetAffinity
Peter Krempa
pkrempa at redhat.com
Tue Oct 27 13:59:20 UTC 2020
On Tue, Oct 27, 2020 at 13:59:17 +0100, Martin Kletzander wrote:
> 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 at redhat.com>
> ---
> src/util/virprocess.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
More information about the libvir-list
mailing list