]> git.sur5r.net Git - openldap/commitdiff
Plug memory leaks when modrdn failure. Fix Typo in debug message.
authorHallvard Furuseth <hallvard@openldap.org>
Fri, 3 Sep 1999 05:12:24 +0000 (05:12 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Fri, 3 Sep 1999 05:12:24 +0000 (05:12 +0000)
servers/slapd/modrdn.c

index 20c5249f898fe41ef15784692750a3761a1ecb2d..e341abf8adbbcbc083e765f6d58a3e280b6edf19 100644 (file)
@@ -111,16 +111,20 @@ do_modrdn(
                               0, 0, 0 );
                        send_ldap_disconnect( conn, op,
                                LDAP_PROTOCOL_ERROR, "newSuperior requires LDAPv3" );
+                       free( ndn );
+                       free( newrdn );
                        return -1;
                }
 
                if ( ber_scanf( op->o_ber, "a", &newSuperior ) 
                     == LBER_ERROR ) {
 
-                   Debug( LDAP_DEBUG_ANY, "ber_scanf(\"a\"}) failed\n",
+                   Debug( LDAP_DEBUG_ANY, "ber_scanf(\"a\") failed\n",
                           0, 0, 0 );
                        send_ldap_disconnect( conn, op,
                                LDAP_PROTOCOL_ERROR, "decoding error" );
+                       free( ndn );
+                       free( newrdn );
                    return -1;
                }
 
@@ -131,9 +135,7 @@ do_modrdn(
                                newSuperior, 0, 0 );
                        send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                                "invalid (new superior) DN", NULL, NULL );
-                       free( ndn );
-                       free( newrdn );
-                       return rc;
+                       goto done;
                }
 
        }
@@ -155,11 +157,9 @@ do_modrdn(
        }
 
        if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
-               free( ndn );
-               free( newrdn ); 
-               free( newSuperior );
                Debug( LDAP_DEBUG_ANY, "do_modrdn: get_ctrls failed\n", 0, 0, 0 );
-               return rc;
+               /* get_ctrls has sent results.  Now clean up. */
+               goto done;
        } 
 
        Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n",