From 6b8e961399549c5c8fdf06875e5981c564829ad6 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 12 Mar 2021 10:12:51 +0100 Subject: [PATCH] virLockSpacePreExecRestart: Avoid use-after-free Recent refactor marked 'object' which is returned from the function as autofree but forgot to use g_steal_pointer in the return statement to prevent freeing it. Fixes: 9a1651f64d7 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/util/virlockspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index f253091f39..9e80db6a0c 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -472,7 +472,7 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace) goto error; virMutexUnlock(&lockspace->lock); - return object; + return g_steal_pointer(&object); error: virMutexUnlock(&lockspace->lock);