mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
2ee00d5905
commit
0278c77da8
|
@ -372,6 +372,7 @@ virObjectAutoUnref(void *objptr)
|
|||
{
|
||||
virObjectPtr *obj = objptr;
|
||||
virObjectUnref(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue