]> git.sur5r.net Git - openldap/commitdiff
Plug memleak
authorHoward Chu <hyc@openldap.org>
Wed, 24 Aug 2011 13:36:21 +0000 (06:36 -0700)
committerHoward Chu <hyc@openldap.org>
Wed, 24 Aug 2011 13:36:21 +0000 (06:36 -0700)
servers/slapd/back-mdb/dn2id.c

index f3dcfe0b3bd4b02714bbc926eaec494cb8f98f48..82ec07b7f1c8b5df96b9529f755655b8d2f9a164 100644 (file)
@@ -310,10 +310,8 @@ mdb_dn2id(
                data.mv_data = d;
                rc = mdb_cursor_get( cursor, &key, &data, MDB_GET_BOTH );
                op->o_tmpfree( d, op->o_tmpmemctx );
-               if ( rc ) {
-                       mdb_cursor_close( cursor );
+               if ( rc )
                        break;
-               }
                ptr = (char *) data.mv_data + data.mv_size - sizeof(ID);
                memcpy( &nid, ptr, sizeof(ID));
 
@@ -343,6 +341,7 @@ mdb_dn2id(
                }
        }
        *id = nid; 
+       mdb_cursor_close( cursor );
        if ( matched && matched->bv_len ) {
                ptr = op->o_tmpalloc( matched->bv_len+1, op->o_tmpmemctx );
                strcpy( ptr, matched->bv_val );