[Libguestfs] [PATCH] diff: avoid potential null pointer dereference on error

Eric Blake eblake at redhat.com
Fri Nov 3 17:48:37 UTC 2017


On 11/03/2017 11:19 AM, Pino Toscano wrote:
> If visit_guest() fails, then it returns a null pointer; later on,
> free_tree() is called unconditionally on the variables, thus
> dereferencing null pointers.
> 
> Thus guard the free_tree() invocations.

Would it be any better to teach free_tree() to be more free()-like by
being a no-op on NULL?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171103/2d6c5c83/attachment.sig>


More information about the Libguestfs mailing list