From 0278c77da8d5b7b586165361e93a6d6d19498c62 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 26 Feb 2019 17:07:42 +0100 Subject: [PATCH] util: object: Reset pointer when unrefing object in virObjectAutoUnref MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The helper function is used by the VIR_AUTOUNREF macro. Prior art is to clear the pointer even if the variable goes out of scope. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/util/virobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virobject.c b/src/util/virobject.c index a4cbd08077..f08c18ce44 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -372,6 +372,7 @@ virObjectAutoUnref(void *objptr) { virObjectPtr *obj = objptr; virObjectUnref(*obj); + *obj = NULL; } -- GitLab