This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Mach-O: fix two memory leaks
On Dec 15, 2011, at 2:40 PM, Iain Sandoe wrote:
>
> On 15 Dec 2011, at 13:34, Tristan Gingold wrote:
>
>>
>> On Dec 15, 2011, at 2:28 PM, Iain Sandoe wrote:
>>
>>>
>>> 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…
>>
>> Well spotted. Thanks.
>>
>> I can commit it, but you forgot to write the ChangeLog entry :-)
>
> so I did :-)
Thanks, committed.
> 11-12-xx Tristan Gingold <...
> Iain Sandoe <…
Please, don't forget your email address, so that C&P works well!
Tristan.
>
> bfd:
>
> * mach-o.c (bfd_mach_o_mkobject_init): Initialize dyn_reloc_cache.
> (bfd_mach_o_close_and_cleanup): Only cleanup Mach-O private data
> for object files.
>
> ....
> cheers
> Iain
>
>
>>
>> Tristan.
>>
>>>
>>> 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);
>>> }
>>>
>>>
>>> <11121513-cleanup-diff.txt>
>>>
>>>
>>
>