memory leak -- comments?

derrell at samba.org derrell at samba.org
Thu Dec 15 23:47:55 GMT 2005


Jeremy Allison <jra at samba.org> writes:

> On Thu, Dec 15, 2005 at 06:39:01PM -0500, derrell at samba.org wrote:
>> Hi Jeremy,
>> 
>> I received the attached report, including valgrind output.  It looks to me as
>> if cli_receive_trans() allocates 'param' and 'data', and then, back in
>> cli_list_new(), if one of these three conditions is true, we'll have a memory
>> leak:
>> 
>>   if (cli_is_error_cli(cli) || !rdata || !rparam)
>> 
>> or
>> 
>>   if (ff_searchcount == 0)
>> 
>> or
>>   if (!tdl)      /* malloc failed)
>> 
>> Of these, the one likely to occur is ff_searchcount == 0.  I suspect that
>> was the cause of this report.  Agree?  Each of these cases should be
>> SAFE_FREE()ing rdata and rparam, right?
>
> Looks correct to me. All exits after cli_receive_trans() should
> be freeing rdata and rparam.
>
> Do you want me to fix it ?

Sure.  I'm on my way out to to wrestling class right now anyway.

Jerry should probably get that fix into the release.

Derrell


More information about the samba-technical mailing list