]> git.sur5r.net Git - openldap/commitdiff
Don't call idl_free() unless necessary.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 5 Feb 1999 23:46:03 +0000 (23:46 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 5 Feb 1999 23:46:03 +0000 (23:46 +0000)
servers/slapd/back-ldbm/index.c

index 9ac95992d960563f7e1f5cdcf6ba26c8f1c22327..18279f214351b8dfabdddc3fd358abf5ac956311 100644 (file)
@@ -168,19 +168,20 @@ add_value(
 {
        int     rc;
        Datum   key;
-       ID_BLOCK        *idl;
-       char    prefix;
-       char    *realval, *tmpval, *s;
+       ID_BLOCK        *idl = NULL;
+       char    *tmpval = NULL;
+       char    *realval = val;
        char    buf[BUFSIZ];
 
+       char    prefix = index2prefix( indextype );
+
        ldbm_datum_init( key );
 
-       prefix = index2prefix( indextype );
        Debug( LDAP_DEBUG_TRACE, "=> add_value( \"%c%s\" )\n", prefix, val, 0 );
 
        realval = val;
        tmpval = NULL;
-       idl = NULL;
+
        if ( prefix != UNKNOWN_PREFIX ) {
               unsigned int     len = strlen( val );
 
@@ -203,7 +204,10 @@ add_value(
        if ( tmpval != NULL ) {
                free( tmpval );
        }
-       idl_free( idl );
+
+       if( idl != NULL ) {
+               idl_free( idl );
+       }
 
        ldap_pvt_thread_yield();