[libvirt] using public vir*Free() (instead of virUnref*()) from vir*FreeName() destructors.

Laine Stump laine at laine.org
Thu May 7 16:22:56 UTC 2009


I just noticed in datatypes.c that the 
vir(Network|StoragePool|StorageVol)FreeName destructors call the public 
API vir*Free() functions rather than the local virUnref*(). vir*Free() 
all clear any errors, which seems like it might not be the right thing 
to do (eg, if we're cleaning out the hashtables as part of some 
error-handling path, and haven't yet logged the error).

On the other hand, the public API function does some sanity checking on 
the object to make sure it really is what we think it is before calling 
the unref. So it's got that going for it. (5 points to anyone who 
catches the reference without going to Google) But I don't know enough 
to know whether or not that's important in this case.

So which is more important: the extra sanity check, or not clearing 
existing error codes?




More information about the libvir-list mailing list