[PATCH] Mach-O: fix two memory leaks
Iain Sandoe
developer@sandoe-acoustics.co.uk
Thu Dec 15 13:29:00 GMT 2011
On 15 Dec 2011, at 11:01, Tristan Gingold wrote:
> On Dec 14, 2011, at 3:23 PM, shinichiro hamaji wrote:
>
>> On Wed, Dec 14, 2011 at 11:03 PM, Tristan Gingold <gingold@adacore.com
>> > wrote:
>>>>
>>>> Thanks again for your quick response. Here is the updated patch:
>>>> http://shinh.skr.jp/t/mach-o-leaks-3.patch
>>>
>>> Ok.
>>>
>>> Should I commit it ?
>>
>> Yes, please? Thanks!
>
> Committed.
I suspect that the following was intended -
- otherwise we try to deallocate mach-o data when the input bfd is
the archive header...
cheers
Iain
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.78
diff -u -p -r1.78 mach-o.c
--- bfd/mach-o.c 15 Dec 2011 11:01:14 -0000 1.78
+++ bfd/mach-o.c 15 Dec 2011 13:25:19 -0000
@@ -3202,6 +3202,7 @@ bfd_mach_o_mkobject_init (bfd *abfd)
mdata->commands = NULL;
mdata->nsects = 0;
mdata->sections = NULL;
+ mdata->dyn_reloc_cache = NULL;
return TRUE;
}
@@ -3765,9 +3766,10 @@ bfd_mach_o_close_and_cleanup (bfd *abfd)
{
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
if (bfd_get_format (abfd) == bfd_object && mdata != NULL)
- _bfd_dwarf2_cleanup_debug_info (abfd, &mdata-
>dwarf2_find_line_info);
-
- bfd_mach_o_free_cached_info (abfd);
+ {
+ _bfd_dwarf2_cleanup_debug_info (abfd, &mdata-
>dwarf2_find_line_info);
+ bfd_mach_o_free_cached_info (abfd);
+ }
return _bfd_generic_close_and_cleanup (abfd);
}
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 11121513-cleanup-diff.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20111215/41d17bf6/attachment.txt>
-------------- next part --------------
More information about the Binutils
mailing list