From 4e4356cf2cbba69f652692e5ff5bf4c04a0b40d5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 7 Feb 2007 14:54:57 +0000 Subject: [PATCH] Fix redundant frees --- servers/slapd/oc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/servers/slapd/oc.c b/servers/slapd/oc.c index f49c45c3a0..ef52fc8695 100644 --- a/servers/slapd/oc.c +++ b/servers/slapd/oc.c @@ -422,10 +422,22 @@ oc_delete( ObjectClass *oc ) static void oc_clean( ObjectClass *o ) { - if (o->soc_sups) ldap_memfree(o->soc_sups); - if (o->soc_required) ldap_memfree(o->soc_required); - if (o->soc_allowed) ldap_memfree(o->soc_allowed); - if (o->soc_oidmacro) ldap_memfree(o->soc_oidmacro); + if (o->soc_sups) { + ldap_memfree(o->soc_sups); + o->soc_sups = NULL; + } + if (o->soc_required) { + ldap_memfree(o->soc_required); + o->soc_required = NULL; + } + if (o->soc_allowed) { + ldap_memfree(o->soc_allowed); + o->soc_allowed = NULL; + } + if (o->soc_oidmacro) { + ldap_memfree(o->soc_oidmacro); + o->soc_oidmacro = NULL; + } } static void @@ -476,7 +488,7 @@ oc_next( ObjectClass **oc ) { assert( oc != NULL ); -#if 1 /* pedantic check */ +#if 0 /* pedantic check: breaks when deleting an oc, don't use it. */ { ObjectClass *tmp = NULL; -- 2.39.5