DD1984 / sockperf

Automatically exported from code.google.com/p/sockperf
Other
1 stars 0 forks source link

memory leak upon TCP accept #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. start server over valgrind: valgrind sockperf sr --tcp
2. start client using: sockperf pp --tcp -i <server-ip>
3. after client completed, press CTRL-C in the server

What is the expected output? What do you see instead?
clean termination of sockperf server and valgrind

Please use labels and text to provide additional information.
valgrind, reports 128KB leak in server_accept
==11270== 131,012 bytes in 1 blocks are definitely lost in loss record 3 of 3
==11270==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==11270==    by 0x656009: Server<IoRecvfrom, SwitchOff, 
SwitchOff>::server_accept(int) (Server.cpp:258)
==11270==    by 0x65905D: Server<IoRecvfrom, SwitchOff, SwitchOff>::doLoop() 
(Server.cpp:198)
==11270==    by 0x65B789: void server_handler<IoRecvfrom, SwitchOff, 
SwitchOff>(int, int, int) (Server.h:58)
==11270==    by 0x66AAB9: main (SockPerf.cpp:2818)

The leak is in the following line:
Server.cpp:258: tmp->recv.buf = (uint8_t*) malloc 
(sizeof(uint8_t)*2*MAX_PAYLOAD_SIZE);

This code was introduced in revision 133.

*Note: this leak is repeated for any time the server performs tcp accept*
Also note: there is similar leak, that happens one time in the initialization 
in the following line:
SockPerf.cpp 2693: tmp->recv.buf = (uint8_t*) malloc 
(sizeof(uint8_t)*2*MAX_PAYLOAD_SIZE);

*Please handle them both!*

Original issue reported on code.google.com by avne...@gmail.com on 23 Sep 2012 at 11:33

GoogleCodeExporter commented 9 years ago

Original comment by avne...@gmail.com on 24 Sep 2012 at 8:47

GoogleCodeExporter commented 9 years ago
Daria - Please handle!
(also, please join sockperf-dev list.
Thanks,
 Avner

Original comment by avne...@gmail.com on 27 Sep 2012 at 3:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
fixed in revision 187

Original comment by daria.za...@gmail.com on 15 Oct 2012 at 8:33