[Freeipa-devel] [PATCH 0050] Fix memory leak in configuration with multiple LDAP instances

Adam Tkac atkac at redhat.com
Wed Sep 5 11:02:23 UTC 2012


On Tue, Aug 14, 2012 at 04:00:21PM +0200, Petr Spacek wrote:
> Hello,
> 
> this patch fixes $SUBJ$.
> 
> Adam, please double-check correctness of this change.
> 
> I had two assumptions:
> - all locking is done inside dns_db_(un)register() functions
> - LDAP instances are decommissioned before dynamic_driver_destroy() call

Ack

> From e314eb7da7bfbbb2ae9d4ce1252d886c9a744e7f Mon Sep 17 00:00:00 2001
> From: Petr Spacek <pspacek at redhat.com>
> Date: Tue, 14 Aug 2012 15:53:42 +0200
> Subject: [PATCH] Fix memory leak in configuration with multiple LDAP
>  instances.
> 
> Signed-off-by: Petr Spacek <pspacek at redhat.com>
> ---
>  src/ldap_driver.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ldap_driver.c b/src/ldap_driver.c
> index d958d15bdebe5e89dc4948655ffba655073d53e0..117215ae480cdcabb2977037af9a89bb25578243 100644
> --- a/src/ldap_driver.c
> +++ b/src/ldap_driver.c
> @@ -1278,6 +1278,7 @@ isc_result_t
>  dynamic_driver_init(isc_mem_t *mctx, const char *name, const char * const *argv,
>  		    dns_dyndb_arguments_t *dyndb_args)
>  {
> +	dns_dbimplementation_t *ldapdb_imp_new = NULL;
>  	isc_result_t result;
>  
>  	REQUIRE(name != NULL);
> @@ -1305,11 +1306,12 @@ dynamic_driver_init(isc_mem_t *mctx, const char *name, const char * const *argv,
>  	}
>  
>  	/* Register new DNS DB implementation. */
> -	ldapdb_imp = NULL;
>  	result = dns_db_register(ldapdb_impname, &ldapdb_create, NULL, mctx,
> -				 &ldapdb_imp);
> +				 &ldapdb_imp_new);
>  	if (result != ISC_R_SUCCESS && result != ISC_R_EXISTS)
>  		return result;
> +	else if (result == ISC_R_SUCCESS)
> +		ldapdb_imp = ldapdb_imp_new;
>  
>  	/* Finally, create the instance. */
>  	result = manager_create_db_instance(mctx, name, argv, dyndb_args);
> -- 
> 1.7.11.2
> 


-- 
Adam Tkac, Red Hat, Inc.




More information about the Freeipa-devel mailing list