[PATCH] solib_open, memory leak

msnyder@sonic.net msnyder@sonic.net
Thu Aug 9 18:37:00 GMT 2007


>
> msnyder@sonic.net writes:
>> [Jim:]
>>> The code clearly deserves a comment like:
>>>
>>>     /* We try to find the library in various ways.  After each
>>>        attempt, either found_file >= 0 and temp_pathname is a malloc'd
>>>        string, or found_file < 0 and temp_pathname does not point to
>>>        storage that needs to be freed.  */
>>>
>>> In that light, it seems clearer to me to just put:
>>>
>>>    if (found_file < 0)
>>>      temp_pathname = NULL;
>>>    else
>>>      temp_pathname = xstrdup (temp_pathname);
>>>
>>> immediately after the open, to make it obvious that the rule is
>>> followed there.
>>>
>> [...]
>>> Don't you want those new lines to replace the two that followed them,
>>> not just precede them?
>>
>> Yes, thanks.  How about this?
>
> Poifect.

Committed.




More information about the Gdb-patches mailing list