[libvirt] [PATCH for v4.6.0] cgroups: Don't leave stale pointers around after virCgroupFree
Daniel P. Berrangé
berrange at redhat.com
Mon Jul 30 08:48:51 UTC 2018
On Mon, Jul 30, 2018 at 10:25:05AM +0200, Michal Privoznik wrote:
> One of the attributes that original virCgroupFree() had was it
> set passed pointer to NULL. For instance in the following code
> the latter call would be practically a no-op:
>
> virCgroupFree(&var);
> virCgroupFree(&var);
>
> However, this behaviour of the function was changed in
> 0f80c71822d824 but corresponding 'var = NULL' lines were not
> added leading to double free:
Sigh, can we please just revert that change. It is going in completely the
oppposite of what we should be doing. We want to change more functions to
take a ptr to a ptr, precisely because it avoids this double-free problem.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list