Modified users of this code to free matched if set.
if ( (pdn = dn_parent( be, dn )) != NULL ) {
char *matched;
/* no parent */
- matched = NULL;
/* get entry with reader lock */
if ( (p = dn2entry_r( be, pdn, &matched )) == NULL ) {
0, 0 );
send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
matched, "" );
+
if ( matched != NULL ) {
free( matched );
}
rc = -1;
goto return_results;
}
- if ( matched != NULL ) {
- free( matched );
- }
if ( ! access_allowed( be, conn, op, p, "children", NULL,
op->o_dn, ACL_WRITE ) ) {
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char *matched = NULL;
+ char *matched;
char *newDN = NULL;
int depth;
Entry *eMatched;
/* free reader lock */
cache_return_entry_r(&li->li_cache, eMatched);
- if (*matched) {
+ if ((matched != NULL) && *matched) {
char *submatch;
/*
if ((eNew = derefAlias_r( be, conn, op, eMatched )) == NULL) {
free (matched);
+ matched = NULL;
free (newDN);
newDN = NULL;
free (remainder);
free (newDN);
newDN = NULL;
free (matched);
+ matched = NULL;
free (remainder);
break;
}
* the new dn together
*/
free (newDN);
- free (matched);
-
newDN = ch_malloc (strlen(eMatched->e_dn) + rlen + 1);
strcpy (newDN, remainder);
strcat (newDN, eMatched->e_dn);
Debug( LDAP_DEBUG_TRACE, "<= expanded to %s\n", newDN, 0, 0 );
+ free (matched);
+ matched = NULL;
free (remainder);
/* free reader lock */
}
Debug( LDAP_DEBUG_TRACE, "<= returning deref DN of %s\n", newDN, 0, 0 );
- free(matched);
+ if (matched != NULL) free(matched);
return newDN;
}
Entry *e;
Attribute *a;
int rc;
- char *matched = NULL;
+ char *matched;
#ifdef HAVE_KERBEROS
char krbname[MAX_K_NAME_SZ + 1];
AUTH_DAT ad;
/* get entry with reader lock */
if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) {
send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched, "" );
+
+ if(matched == NULL) free(matched);
return( 1 );
}
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char *matched = NULL;
+ char *matched;
char *pdn = NULL;
Entry *e, *p;
/* XXX delete from parent's id2children entry XXX */
pdn = dn_parent( be, dn );
- matched = NULL;
p = dn2entry_r( be, pdn, &matched );
if ( id2children_remove( be, p, e ) != 0 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "","" );
/* free entry and writer lock */
cache_return_entry_w( &li->li_cache, e );
- if ( p )
+ if ( p != NULL )
cache_return_entry_r( &li->li_cache, p );
+ if ( matched != NULL ) free(matched);
+
send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
return( 0 );
/* free entry and writer lock */
cache_return_entry_w( &li->li_cache, e );
- if( p )
+ if( p != NULL )
cache_return_entry_r( &li->li_cache, p );
+ if ( matched != NULL ) free(matched);
+
return( -1 );
}
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
- Entry *e;
+ Entry *e = NULL;
char *pdn;
Debug(LDAP_DEBUG_TRACE, "dn2entry_%s: dn: %s\n",
rw ? "w" : "r", dn, 0);
+ *matched = NULL;
+
if ( (id = dn2id( be, dn )) != NOID &&
(e = id2entry( be, id, rw )) != NULL )
{
return( e );
}
- *matched = NULL;
/* stop when we get to the suffix */
if ( be_issuffix( be, dn ) ) {
return( NULL );
}
-#if 0
- if (e->e_state == ENTRY_STATE_DELETED)
- continue;
-
- if (strcmp(dn, e->e_dn) != 0)
- continue;
-
- /* return locked entry entry */
- return(e);
- }
-}
-#endif
-
Entry *
dn2entry_r(
Backend *be,
free(matched);
return( 1 );
}
- Debug( LDAP_DEBUG_ARGS, "=> ldbm_back_group: found bdn: %s matched: %s\n", bdn, (matched ? matched : ""), 0 );
+
+ Debug( LDAP_DEBUG_ARGS, "=> ldbm_back_group: found bdn: %s\n", bdn, 0, 0 );
/* check for deleted */
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- char *matched = NULL;
+ char *matched;
Entry *e;
int i, err;
LDAPMod *mod;
ID id;
Entry *e;
Attribute *ref;
- char *matched = NULL;
+ char *matched;
int rmaxsize, nrefs;
char *rbuf, *rcur, *r;
int nentries = 0;