memory leakage in libsmbclients?

Sorin Manolache sorinm at gmail.com
Thu Oct 21 23:30:04 GMT 2004


Hello,

I am using samba-3.0.7 on Linux 2.4.22 with glibc-2.3.2.

I'm writing a robot that gets a list of IPs, tries to connect through
samba to them and retrieve a list of all publicly available files on
the remote machine. The robot is linked with libsmbclient.

Let us suppose the IP is 130.123.123.123

First I do smbc_opendir on smb://130.123.123.123 then I do
smbc_readdir, and for each file share I do smbc_opendir
smb://130.123.123.123/share. I am careful to pair each smbc_opendir
with a smbc_closedir.

I have a list of approximately 8400 IPs, most of which do not run
samba or are shut down when I scan them. Thus, most (thousands)
smbc_opendir calls will return -1.

My problem is that my program leaks memory. Almost 200kB per
unsuccessful connection attempt. Do you have any suggestions how I
could avoid that? Is there any other function, such as
smbc_remove_unused_server, that I should call? Is this leakage normal
because I did something wrong, or is it a bug in libsmbclient?

Thank you,
Sorin


More information about the smb-clients mailing list