bugTransport Sample Protocol - Bugs: bug #19852, memory leak

 
 

bug #19852: memory leak

Submitter:  montigaud <sarah_montigaud>
Submitted:  Fri 11 May 2007 09:31:01 AM UTC
   
 
Category:  None Severity:  3 - Normal
Status:  In Progress Privacy:  Public
Assigned to:  deweerdt Open/Closed:  Open
Release:  * 0.8.3 Fixed Release:  * NextRelease
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 06 Dec 2007 01:34:09 PM UTC, comment #4: 

Hello,

I got back the last version of the file tsp_consumer.c (v1.64).
I have passed the test where memory leak appears.

The following memory leak is still present:
    >malloc (vg_replace_malloc.c:149)
    >strdup (in /lib/tls/libc-2.3.4.so)
    >TSP_SSI_copy (tsp_common_ssi.c:210)
    >TSP_SSIList_copy (tsp_common_ssi.c:313)
    >TSP_consumer_request_sample (tsp_consumer.c:1012)


The others memory leaks due to "xdr_TSP_answer_sample" have disappear.

Thanks

Alaux Virginie <virginie>
Tue 28 Aug 2007 09:46:03 AM UTC, comment #3: 

The XDR related leaks are fixed in CVS. Could you confirm this Sarah?

Frederik Deweerdt <deweerdt>
Group administrator
Tue 26 Jun 2007 10:07:48 PM UTC, comment #2: 

Is this bug still alive or did Yves find time
to fix it in CVS?

Eric NOULARD <erk>
Group administrator
Fri 11 May 2007 01:12:58 PM UTC, comment #1: 

Ok thanks.
I will have look at this.

tsp_consumer.c code not always use TSP_SSI[List] functions
(defined in tsp_common.c)
as it should thus the leak.


Eric NOULARD <erk>
Group administrator
Fri 11 May 2007 09:31:01 AM UTC, original submission:  

Hello world,

For my project, in order to find memory leak, i use valgrind with options --tool=memcheck --leak-check=yes --num-callers=20 .
In this way, i find some memory leaks on tsp_consumer.c. I try to investigate but i don't find all of solutions.

In tsp_consumer.c method tsp_consumer_request_sample():
476 bytes in 43 blocks are definitely lost in loss record 306 of 368

>malloc (vg_replace_malloc.c:149)
>strdup (in /lib/tls/libc-2.3.4.so)
>TSP_SSI_copy (tsp_common_ssi.c:210)
>TSP_SSIList_copy (tsp_common_ssi.c:313)
>TSP_consumer_request_sample (tsp_consumer.c:988)

Possible solution:
Add the line "  TSP_SSIList_finalize(&(req_sample.symbols));
" at 1013 to desallocate the name of each elements of the list req_sample.symbols

In tsp_consumer.c method tsp_consumer_request_sample():
1,795 (1,400 direct, 395 indirect) bytes in 3 blocks are definitely lost in loss record 322 of 368
at 0x40056BF: calloc (vg_replace_malloc.c:279)
by 0xA52FCD: xdr_array (in /lib/tls/libc-2.3.4.so)
by 0x433558D: xdr_TSP_sample_symbol_info_list_t (tsp_rpc_xdr.c:470)
by 0x4335FFB: xdr_TSP_answer_sample_t (tsp_rpc_xdr.c:697)
by 0xA4C91A: clnttcp_call (in /lib/tls/libc-2.3.4.so)
by 0x4333BBC: tsp_request_sample_1 (tsp_rpc_clnt.c:104)
by 0x4337A5E: TSP_request_sample (tsp_client.c:248)
by 0x432FA25: TSP_consumer_request_sample (tsp_consumer.c:991)

I think the pb is the desallocation of ans_sample
I try this correction but the mem leak is not complety correct:
at line 1056  
if(ans_sample->symbols.TSP_sample_symbol_info_list_t_val)
  {
      for (i = 0 ;  i < ans_sample->symbols.TSP_sample_symbol_info_list_t_len ; i++)
{
  /* free strdup */
  free(ans_sample->symbols.TSP_sample_symbol_info_list_t_val[i].name);
}
  }

In tsp_consumer.c method tsp_consumer_request_sample_init():
at 0x4004405: malloc (vg_replace_malloc.c:149)
by 0xA52DAE: xdr_string (in /lib/tls/libc-2.3.4.so)
by 0x433637B: xdr_TSP_answer_sample_init_t (tsp_rpc_xdr.c:764)
by 0xA4C91A: clnttcp_call (in /lib/tls/libc-2.3.4.so)
by 0x4333C46: tsp_request_sample_init_1 (tsp_rpc_clnt.c:119)
by 0x4337C32: TSP_request_sample_init (tsp_client.c:263)
by 0x433083F: TSP_consumer_request_sample_init (tsp_consumer.c:1116)

possible solution:
/*desallocation of ans_sample*/
if(ans_sample->data_address!=NULL)
{  free(ans_sample->data_address);}

I think you may be have the problem of desallocation of ans_sample on other tsp request .

If you have time to look at desallocation in tsp_consumer.c ....

Thanks in advance
---
Sarah



montigaud <sarah_montigaud>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by virginie (Posted a comment)
  • -email is unavailable- added by deweerdt (Updated the item)
  • -email is unavailable- added by tsp_admin (Updated the item)
  • -email is unavailable- added by erk (Posted a comment)
  • -email is unavailable- added by sarah_montigaud (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-08-28 deweerdt StatusNone In Progress
        Fixed ReleaseUnknown NextRelease
    2007-08-28 deweerdt Assigned todufy deweerdt
    2007-06-26 erk Fixed Release0.8.3 Unknown
    2007-06-13 tsp_admin Assigned toNone dufy

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code