From: grapvar Date: Tue, 14 Apr 2020 21:47:00 +0000 (+0000) Subject: ITS#9214 slapd-mdb: plug cursor leak in dnSuperiorMatch filter X-Git-Tag: OPENLDAP_REL_ENG_2_4_50~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8b5c6917f3149d92d57b9b62b553e1966fdc0fa;p=thirdparty%2Fopenldap.git ITS#9214 slapd-mdb: plug cursor leak in dnSuperiorMatch filter --- diff --git a/servers/slapd/back-mdb/dn2id.c b/servers/slapd/back-mdb/dn2id.c index e4c02a24bb..acecc5036f 100644 --- a/servers/slapd/back-mdb/dn2id.c +++ b/servers/slapd/back-mdb/dn2id.c @@ -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",