Re: [PATCH] solib_open, memory leak

Jim Blandy
2007-08-08T22:08:40Z

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.