s4:hdb-samba4 - Don't double-free "db"

Andrew Bartlett abartlet at samba.org
Tue Oct 13 15:29:58 MDT 2009


On Tue, 2009-10-13 at 10:39 -0500, Matthias Dieter Wallnöfer wrote:
> The branch, master has been updated
>        via  11a8a54... s4:hdb-samba4 - Don't double-free "db"
>        via  c183acc... s4:dcesrv_samr - add another constant
>       from  6b91a2a... s4:dcesrv_samr - prevent "ldb_modify" on a possibly empty message
> 
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> 
> 
> - Log -----------------------------------------------------------------
> commit 11a8a54c825a52d7dd6ab78bc7aeff2d719327d2
> Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
> Date:   Tue Oct 13 17:36:58 2009 +0200
> 
>     s4:hdb-samba4 - Don't double-free "db"
>     
>     "db" is freed anyway after the destructor terminates so this does really make
>     no sense here (rather it makes code crash).
>     
>     Should fix bug #6801.

> Changeset truncated at 500 lines:
> 
> diff --git a/source4/kdc/hdb-samba4.c b/source4/kdc/hdb-samba4.c
> index 4062e13..bed6ee9 100644
> --- a/source4/kdc/hdb-samba4.c
> +++ b/source4/kdc/hdb-samba4.c
> @@ -1442,7 +1442,6 @@ static krb5_error_code hdb_samba4_nextkey(krb5_context context, HDB *db, unsigne
>  
>  static krb5_error_code hdb_samba4_destroy(krb5_context context, HDB *db)
>  {
> -	talloc_free(db);
>  	return 0;
>  }
>  

Unfortunately this is not correct - you are confusing the database and
the entry, and with your change we now leak the database pointer.  The
actual bug is in hdb_end_seq_get().  We should free the entry before we
close the database.  I'll push a fix shortly. 

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20091014/3b43c4f4/attachment.pgp>


More information about the samba-technical mailing list