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

Pino Toscano ptoscano at redhat.com
Mon Nov 6 11:46:33 UTC 2017


On Friday, 3 November 2017 22:24:13 CET Richard W.M. Jones wrote:
> On Fri, Nov 03, 2017 at 12:48:37PM -0500, Eric Blake wrote:
> > 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?
> 
> Yes, I agree with Eric on this.

OK -- patch amended, and pushed.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171106/f17ff318/attachment.sig>


More information about the Libguestfs mailing list