]> git.sur5r.net Git - openldap/commitdiff
ITS#7915 fix memory leaks in previous patch
authorLeo Yuriev <leo@yuriev.ru>
Wed, 10 Sep 2014 00:08:18 +0000 (04:08 +0400)
committerHoward Chu <hyc@openldap.org>
Wed, 10 Sep 2014 10:51:44 +0000 (11:51 +0100)
servers/slapd/back-mdb/id2entry.c

index 6cbeaf88fb8ef8a642f60d28754a70eb403eeabe..1be3626798bfd79a013b487aee9e6af028d5be68 100644 (file)
@@ -272,9 +272,11 @@ int mdb_entry_release(
        /* slapMode : SLAP_SERVER_MODE, SLAP_TOOL_MODE,
                        SLAP_TRUNCATE_MODE, SLAP_UNDEFINED_MODE */
  
+       int release = 1;
        if ( slapMode & SLAP_SERVER_MODE ) {
                OpExtra *oex;
                LDAP_SLIST_FOREACH( oex, &op->o_extra, oe_next ) {
+                       release = 0;
                        if ( oex->oe_key == mdb ) {
                                mdb_entry_return( op, e );
                                moi = (mdb_op_info *)oex;
@@ -291,9 +293,10 @@ int mdb_entry_release(
                                break;
                        }
                }
-       } else {
-               mdb_entry_return( op, e );
        }
+
+       if (release)
+               mdb_entry_return( op, e );
  
        return 0;
 }