[PATCH] Fix memory leak onto long-term context in ldb_tdb (guid index)

Jeremy Allison jra at samba.org
Thu Jun 14 23:56:47 UTC 2018


On Wed, Jun 13, 2018 at 11:37:40AM +0200, Andrew Bartlett via samba-technical wrote:
> After a duplicated add a small amount of memory can be leaked onto a
> long-term context.
> 
> Found by Andrej Gessel https://github.com/andiges

LGTM. Pushed - thanks !

> From 532464cfd0ac97f31378e0cbbb798c0c68de7728 Mon Sep 17 00:00:00 2001
> From: Andrew Bartlett <abartlet at samba.org>
> Date: Wed, 13 Jun 2018 11:20:00 +0200
> Subject: [PATCH] ldb_tdb: Use mem_ctx and so avoid leak onto long-term memory
>  on duplicated add.
> 
> After a duplicated add a small amount of memory can be leaked onto a
> long-term context.
> 
> Found by Andrej Gessel https://github.com/andiges
> 
> https://github.com/samba-team/samba/commit/e8fb45125e6a279b918694668e0d4fbddac10aee#commitcomment-29334102
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=13471
> Signed-off-by: Andrew Bartlett <abartlet at samba.org>
> ---
>  lib/ldb/ldb_tdb/ldb_tdb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
> index 85816040ac7..51d608723e8 100644
> --- a/lib/ldb/ldb_tdb/ldb_tdb.c
> +++ b/lib/ldb/ldb_tdb/ldb_tdb.c
> @@ -626,7 +626,7 @@ static int ltdb_add_internal(struct ldb_module *module,
>  			if (mem_ctx == NULL) {
>  				return ldb_module_operr(module);
>  			}
> -			ret2 = ltdb_search_base(module, module,
> +			ret2 = ltdb_search_base(module, mem_ctx,
>  						msg->dn, &dn2);
>  			TALLOC_FREE(mem_ctx);
>  			if (ret2 == LDB_SUCCESS) {
> -- 
> 2.14.4
> 




More information about the samba-technical mailing list