From aa983f343ee1f7a59d9d2c394bffe79ccc8b2d86 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 4 May 2001 01:02:36 +0000 Subject: [PATCH] Clean up entry_free() assert of e_private was not freed by caller --- servers/slapd/entry.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index a7cb17baef..bf59a51f1e 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -320,8 +320,14 @@ entry2str( void entry_free( Entry *e ) { - Attribute *a, *next; + /* free an entry structure */ + assert( e != NULL ); + /* e_private must be freed by the caller */ + assert( e->e_private == NULL ); + e->e_private = NULL; + + /* free DNs */ if ( e->e_dn != NULL ) { free( e->e_dn ); e->e_dn = NULL; @@ -330,12 +336,11 @@ entry_free( Entry *e ) free( e->e_ndn ); e->e_ndn = NULL; } - for ( a = e->e_attrs; a != NULL; a = next ) { - next = a->a_next; - attr_free( a ); - } + + /* free attributes */ + attrs_free( e->e_attrs ); e->e_attrs = NULL; - e->e_private = NULL; + free( e ); } -- 2.39.5