util: object: Reset pointer when unrefing object in virObjectAutoUnref

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-02-26 17:07:42 +01:00
parent 2ee00d5905
commit 0278c77da8
1 changed files with 1 additions and 0 deletions

View File

@ -372,6 +372,7 @@ virObjectAutoUnref(void *objptr)
{
virObjectPtr *obj = objptr;
virObjectUnref(*obj);
*obj = NULL;
}