Memory leaks in smbd ?

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Nov 14 17:18:07 GMT 2008


Hi!

On Fri, Nov 14, 2008 at 09:13:18AM +0100, Martin Zielinski wrote:

> diff -urN source/auth/auth_util.c source.samu/auth/auth_util.c
> --- source/auth/auth_util.c	2008-09-18 08:49:02.000000000 +0200
> +++ source.samu/auth/auth_util.c	2008-11-13 09:36:06.000000000 +0100
> @@ -1089,6 +1089,7 @@
>  	
>  	status = samu_set_unix( sampass, pwd );
>  	if (!NT_STATUS_IS_OK(status)) {
> +		TALLOC_FREE(sampass);
>  		return status;
>  	}
>  
> @@ -1217,8 +1218,10 @@
>  	if (!NT_STATUS_IS_OK(status)) {
>  		DEBUG(10, ("create_local_token failed: %s\n",
>  			   nt_errstr(status)));
> +		TALLOC_FREE(sampass);
>  		return status;
>  	}
> +	TALLOC_FREE(sampass);

This is all pretty subtle, but for example that last
TALLOC_FREE generates segfaults. Assuming you're talking
about 3.2ff, there is a talloc_steal make_server_info_sam
that makes sure the struct samu gets freed properly.

We could go through all of the ones you marked, but I am
pretty certain that they are freed as part of a higher-level
temporary talloc context.

Did you have a chance to review my memcache.c patch I sent
yesterday? For me it works fine, I am about to commit that
soon.

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20081114/62392c92/attachment.bin


More information about the samba-technical mailing list