[PATCH 1/2] virLockSpacePreExecRestart: Avoid use-after-free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pkrempa@xxxxxxxxxx>
---
 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);
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux