[cairo] Fix some memory leaks + double free

Sylvestre Ledru sylvestre at mozilla.com
Fri May 9 03:02:07 PDT 2014


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!

Cheers,
Sylvestre

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Fix-some-memory-leaks-found-by-scan-build-the-LLVM-C.patch
Type: text/x-patch
Size: 2533 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140509/db16aff0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Remove-some-potential-double-free.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140509/db16aff0/attachment-0001.bin>


More information about the cairo mailing list