]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Plug memleak
authorHoward Chu <hyc@openldap.org>
Sat, 27 Aug 2011 01:23:54 +0000 (18:23 -0700)
committerHoward Chu <hyc@openldap.org>
Sat, 27 Aug 2011 01:34:00 +0000 (18:34 -0700)
servers/slapd/back-mdb/id2entry.c
servers/slapd/back-mdb/libmdb

index 4c7e9b6e83d9aafd6332a4e72ea815dcd2807c6d..10c6c2164881eca13d8ac611e19b745a5bba5f00 100644 (file)
@@ -242,7 +242,8 @@ int mdb_entry_get(
                Debug( LDAP_DEBUG_ACL,
                        "=> mdb_entry_get: cannot find entry: \"%s\"\n",
                                ndn->bv_val, 0, 0 ); 
-               return LDAP_NO_SUCH_OBJECT; 
+               rc = LDAP_NO_SUCH_OBJECT;
+               goto return_results;
        }
        
        Debug( LDAP_DEBUG_ACL,
@@ -269,10 +270,16 @@ int mdb_entry_get(
 return_results:
        if( rc != LDAP_SUCCESS ) {
                /* free entry */
-               mdb_entry_return( e );
+               if ( e )
+                       mdb_entry_return( e );
 
+               if (moi->moi_ref == 1) {
+                       LDAP_SLIST_REMOVE( &op->o_extra, &moi->moi_oe, OpExtra, oe_next );
+                       mdb_txn_reset( txn );
+                       op->o_tmpfree( moi, op->o_tmpmemctx );
+               }
        } else {
-               *ent = entry_dup( e );
+               *ent = e;
        }
 
        Debug( LDAP_DEBUG_TRACE,
index e4ff4cdcd26f5c547ccb98caabc97edb43d3d09a..7a48f12cbbbca1c5781148196e6c621bc776f602 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e4ff4cdcd26f5c547ccb98caabc97edb43d3d09a
+Subproject commit 7a48f12cbbbca1c5781148196e6c621bc776f602