X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fentry.c;h=5de991f4c45991f321e2fb2ca5f180007ddb13bc;hb=fc49135a367e90d8fccbe9ad43c07c61340a74c7;hp=80617959e04fa3a386b29982ecb5bb5aa0b0880e;hpb=0c3899577f5000e25cfa2248b8dcc3aec5af2b56;p=openldap diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 80617959e0..5de991f4c4 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -10,9 +10,6 @@ #include "slap.h" -void entry_free(); -char *entry2str(); - static unsigned char *ebuf; /* buf returned by entry2str */ static unsigned char *ecur; /* pointer to end of currently used ebuf */ static int emaxsize;/* max size of ebuf */ @@ -50,8 +47,6 @@ str2entry( char *s ) s ? s : "NULL", 0, 0 ); e = (Entry *) ch_calloc( 1, sizeof(Entry) ); - /* initialize reader/writer lock */ - entry_rdwr_init(e); /* check to see if there's an id included */ next = s; @@ -61,10 +56,14 @@ str2entry( char *s ) Debug( LDAP_DEBUG_TRACE, "<= str2entry NULL (missing newline after id)\n", 0, 0, 0 ); + free( e ); return( NULL ); } } + /* initialize reader/writer lock */ + entry_rdwr_init(e); + /* dn + attributes */ e->e_attrs = NULL; vals[0] = &bval; @@ -90,11 +89,11 @@ str2entry( char *s ) if ( strcasecmp( type, "dn" ) == 0 ) { if ( e->e_dn != NULL ) { Debug( LDAP_DEBUG_ANY, - "str2entry: entry %d has multiple dns \"%s\" and \"%s\" (second ignored)\n", + "str2entry: entry %lu has multiple dns \"%s\" and \"%s\" (second ignored)\n", e->e_id, e->e_dn, value ); continue; } - e->e_dn = strdup( value ); + e->e_dn = ch_strdup( value ); continue; } @@ -104,6 +103,7 @@ str2entry( char *s ) != 0 ) { Debug( LDAP_DEBUG_TRACE, "<= str2entry NULL (attr_merge)\n", 0, 0, 0 ); + entry_free( e ); return( NULL ); } nvals++; @@ -111,13 +111,13 @@ str2entry( char *s ) /* check to make sure there was a dn: line */ if ( e->e_dn == NULL ) { - Debug( LDAP_DEBUG_ANY, "str2entry: entry %d has no dn\n", + Debug( LDAP_DEBUG_ANY, "str2entry: entry %lu has no dn\n", e->e_id, 0, 0 ); entry_free( e ); return( NULL ); } - Debug( LDAP_DEBUG_TRACE, "<= str2entry 0x%x\n", e, 0, 0 ); + Debug(LDAP_DEBUG_TRACE, "<= str2entry 0x%lx\n", (unsigned long)e, 0,0); return( e ); } @@ -261,4 +261,3 @@ entry_rdwr_init(Entry *e) { return pthread_rdwr_init_np(&e->e_rdwr, NULL); } -