[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

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.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]