[cairo] Fix some memory leaks + double free

Bryce W. Harrington b.harrington at samsung.com
Fri May 16 11:12:57 PDT 2014


On Mon, May 12, 2014 at 11:32:38PM +0200, Sylvestre Ledru wrote:
> On 09/05/2014 12:02, Sylvestre Ledru wrote:
> > On 09/05/2014 11:55, Uli Schlachter wrote:
> >> On 09.05.2014 11:30, Sylvestre Ledru wrote:
> >>> diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
> >>> index c200c28..17fe1df 100644
> >>> --- a/src/cairo-pdf-surface.c
> >>> +++ b/src/cairo-pdf-surface.c
> >>> @@ -2642,6 +2642,10 @@ _cairo_pdf_surface_lookup_jbig2_global (cairo_pdf_surface_t       *surface,
> >>>      }
> >>>  
> >>>      global.id = malloc(global_id_length);
> >>> +    if (unlikely (global.id == NULL)) {
> >>> +	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
> >>> +    }
> >>> +
> >>>      memcpy (global.id, global_id, global_id_length);
> >>>      global.id_length = global_id_length;
> >>>      global.res = _cairo_pdf_surface_new_object (surface);
> >> Thanks, this is what I meant!
> >>
> >> However, to fix your warnings from clang-analyze, don't you still need your
> >> original change, too?
> >>
> > Of course, sorry! Updated!
> >
> >
> Uli, could you checkin the patch? I don't have permissions.
> Thanks,
> Sylvestre

I got it.  Thanks, pushed.

Bryce


More information about the cairo mailing list