]> git.sur5r.net Git - openldap/commitdiff
Avoid unnecessary syncCookie malloc/free
authorHoward Chu <hyc@openldap.org>
Thu, 14 Mar 2013 13:55:44 +0000 (06:55 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 18 Mar 2013 16:40:40 +0000 (09:40 -0700)
servers/slapd/syncrepl.c

index 1fba0b7d301624857fcf10f983ed4f141d981df7..4ffb3621af8573e11516e33c078e32c105aa6984 100644 (file)
@@ -667,11 +667,11 @@ do_syncrep1(
 
                        LDAP_STAILQ_REMOVE( &slap_sync_cookie, sc, sync_cookie, sc_next );
 
-                       /* ctxcsn wasn't parsed yet, do it now */
-                       slap_parse_sync_cookie( sc, NULL );
                        slap_sync_cookie_free( &si->si_syncCookie, 0 );
-                       slap_dup_sync_cookie( &si->si_syncCookie, sc );
-                       slap_sync_cookie_free( sc, 1 );
+                       si->si_syncCookie.octet_str = sc->octet_str;
+                       ch_free( sc );
+                       /* ctxcsn wasn't parsed yet, do it now */
+                       slap_parse_sync_cookie( &si->si_syncCookie, NULL );
                } else {
                        ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
                        if ( !si->si_cookieState->cs_num ) {
@@ -1366,8 +1366,8 @@ do_syncrep2(
                }
                if ( !BER_BVISNULL( &syncCookie.octet_str ) ) {
                        slap_sync_cookie_free( &syncCookie_req, 0 );
-                       slap_dup_sync_cookie( &syncCookie_req, &syncCookie );
-                       slap_sync_cookie_free( &syncCookie, 0 );
+                       syncCookie_req = syncCookie;
+                       memset( &syncCookie, 0, sizeof( syncCookie ));
                }
                ldap_msgfree( msg );
                msg = NULL;