Bug 5656 - memory leaks
memory leaks
Status: RESOLVED INVALID
Product: Samba 3.2
Classification: Unclassified
Component: Winbind
unspecified
Other Windows XP
: P3 normal
: ---
Assigned To: Samba Bugzilla Account
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-31 08:06 UTC by SIMON, Gabor
Modified: 2008-08-12 02:20 UTC (History)
0 users

See Also:


Attachments
fixes mem leaks of wbcAuthenticateUserEx (2.05 KB, patch)
2008-07-31 08:07 UTC, SIMON, Gabor
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description SIMON, Gabor 2008-07-31 08:06:17 UTC
1.,
wbcAuthenticateUserEx() returns a 'struct wbcAuthUserInfo *', but there is no
way to free it (plain free() won't do it if samba was compiled with libtalloc
support).

2.,
wbcAuthenticateUserEx() leaks response->extra_data.data of it local response
structures.
Comment 1 SIMON, Gabor 2008-07-31 08:07:54 UTC
Created attachment 3449 [details]
fixes mem leaks of wbcAuthenticateUserEx
Comment 2 Volker Lendecke 2008-07-31 08:44:21 UTC
2. might be valid. But 1.: Doesn't wbcFreeMemory work for you?

Volker
Comment 3 SIMON, Gabor 2008-07-31 09:09:17 UTC
(In reply to comment #2)
> 2. might be valid.
And only half of it: freeing 'sep_response' is missing, but 'response' is
freed correctly in 3.2.0. (Sorry for the dup.)

> But 1.: Doesn't wbcFreeMemory work for you?
Well, certainly it does, but then everyone who calls wbcAuthenticateUserEx with
non-NULL info should implement wbc_free_auth_info in his client program.
However, if I'm the only one doing so, it may go to client-space as well :).
Comment 4 Jeremy Allison 2008-07-31 18:01:35 UTC
No, you're missing the point of how talloc() works. You don't need to do the free on every part of the structure. You just call wbcFreeMemory() on the returned struct wbcAuthUserInfo pointer and you're done.

I don't think the WINBINDD_INFO call allocates any extra data, so it's safe in this usage. 

I don't see any memory leaks here. Have you tested with valgrind to be sure ?
Jeremy.
Comment 5 SIMON, Gabor 2008-08-01 01:52:45 UTC
(In reply to comment #4)
> No, you're missing the point of how talloc() works. You don't need to do the
> free on every part of the structure.
You are right, I should've read all the manuals first :(. This libtalloc is really a bit more than just-another-malloc-wrapper...

> I don't think the WINBINDD_INFO call allocates any extra data, so it's safe in
> this usage. I don't see any memory leaks here. Have you tested with valgrind
> to be sure ?
It only leaked (naturally) if the returned struct wasn't freed at all. So, issue #1 is just completely invalid, clean case of PEBKAC on my part, sorry.
Comment 6 Volker Lendecke 2008-08-11 14:24:43 UTC
So, can we close this bug now?

Volker
Comment 7 SIMON, Gabor 2008-08-12 02:20:58 UTC
Done.