Memory leak in using smb2_read()?
Stefan (metze) Metzmacher
metze at samba.org
Tue Mar 17 08:23:21 GMT 2009
Hi Sun,
> I am suing Samba4, patch6. I am writing a test case that read a lot a
> large file using smb2_read.
>
>
>
> I understand that the data returned from function smb2_read() is stored
> in struct smb2_read.out.data, which is a DATA_BLOB type that is
> dynamically allocated inside function smb2_read().
>
>
>
> Do we need free the memory used by smb2_read.out.data? I checked the
> examples of Samba4, I didn't see any of them free the memory used by
> smb2_read.out.data. Will this cause memory leaks?
The memory is allocated as a talloc child of the passed mem_ctx,
so the exsting samba4 callers in source4/librpc/ are fine.
The torture tests in source4/torture/smb2 don't really care about memory
leaks.
If you try to add a smb2_read benchmark test you may want to actively
free the DATA_BLOB. Please base your code on the current master branch
(see http://devel.samba.org/), so that we can integrate the tests into
smbtorture.
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20090317/ea2e7c09/signature.bin
More information about the samba-technical
mailing list