Possible memory leak?

Brad Hards bhards at bigpond.net.au
Wed Oct 16 12:57:01 EST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm playing with valgrind, and ran it  with rsync.

I'm really not sure if I'm understanding either the tool or the code, but here 
is an example.

When we're downloading a file in client-server mode, we end up in 
main.c::client_run(), doing a call to flist.c::recv_file_list(). Around line 
1036, we do a malloc of the file list:
        flist = (struct file_list *) malloc(sizeof(flist[0]));
and return flist.

Then we go on to use flist->, but there doesn't ever appear to be a free of 
that memory. client_run() returns, and the pointer is lost.

I tried to fix it with a simple free(), but according to valgrind, that makes 
to leak worse, for reasons I am confused about.

In anycase, does this look like a problem?

Brad

- -- 
http://linux.conf.au. 22-25Jan2003. Perth, Aust. I'm registered. Are you?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9rWArW6pHgIdAuOMRAoZWAKC2JqowLCH5lVPFzzVltOdXxjk2+QCgnB6U
CdpWKEpq2ryO2LG00TJYQYE=
=w3Rv
-----END PGP SIGNATURE-----




More information about the rsync mailing list