]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9214 slapd-mdb: plug cursor leak in dnSuperiorMatch filter
authorgrapvar <grapvar@gmail.com>
Tue, 14 Apr 2020 21:47:00 +0000 (21:47 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 15 Apr 2020 00:10:52 +0000 (00:10 +0000)
servers/slapd/back-mdb/dn2id.c

index e4c02a24bbfb5cc9e4ebf83460906b0fc4c572b1..acecc5036fc5ed780254609065677d047ead0c05 100644 (file)
@@ -485,10 +485,8 @@ mdb_dn2sups(
                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 - 2*sizeof(ID);
                memcpy( &nid, ptr, sizeof(ID));
 
@@ -507,7 +505,7 @@ mdb_dn2sups(
                        break;
                }
        }
-
+       mdb_cursor_close( cursor );
 done:
        if( rc != 0 ) {
                Debug( LDAP_DEBUG_TRACE, "<= mdb_dn2sups: get failed: %s (%d)\n",