From: Howard Chu Date: Mon, 3 Nov 2003 09:54:28 +0000 (+0000) Subject: ITS#2805 fix core dump using LDBM X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~464 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d46195d08d32dc545a57283a8a28cf9c4da003a1;p=openldap ITS#2805 fix core dump using LDBM --- diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index b7d4528d64..b17754d420 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -423,13 +423,16 @@ do_syncrep2( switch( ldap_msgtype( msg ) ) { case LDAP_RES_SEARCH_ENTRY: ldap_get_entry_controls( si->si_ld, msg, &rctrls ); - if ( rctrls ) { - rctrlp = *rctrls; - ber_init2( ber, &rctrlp->ldctl_value, LBER_USE_DER ); - ber_scanf( ber, "{em", &syncstate, &syncUUID ); - if ( ber_peek_tag( ber, &len ) == LDAP_SYNC_TAG_COOKIE ) { - ber_scanf( ber, "m}", &syncCookie ); - } + /* we can't work without the control */ + if ( !rctrls ) { + rc = -1; + goto done; + } + rctrlp = *rctrls; + ber_init2( ber, &rctrlp->ldctl_value, LBER_USE_DER ); + ber_scanf( ber, "{em", &syncstate, &syncUUID ); + if ( ber_peek_tag( ber, &len ) == LDAP_SYNC_TAG_COOKIE ) { + ber_scanf( ber, "m}", &syncCookie ); } entry = syncrepl_message_to_entry( si, op, msg, &modlist, syncstate ); @@ -438,9 +441,7 @@ do_syncrep2( if ( syncCookie.bv_len ) { syncrepl_updateCookie( si, op, psub, &syncCookie ); } - if ( rctrls ) { - ldap_controls_free( rctrls ); - } + ldap_controls_free( rctrls ); if ( modlist ) { slap_mods_free( modlist ); }