mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 07:39:35 -05:00
ITS#2735 - plug memory leaks
This commit is contained in:
parent
3e99679ca4
commit
7fd47cedb7
2 changed files with 19 additions and 5 deletions
|
|
@ -268,7 +268,7 @@ static int
|
||||||
set( Slapi_PBlock *pb, int param, void *val )
|
set( Slapi_PBlock *pb, int param, void *val )
|
||||||
{
|
{
|
||||||
#if defined(LDAP_SLAPI)
|
#if defined(LDAP_SLAPI)
|
||||||
int i;
|
int i, freeit;
|
||||||
|
|
||||||
if ( isValidParam( pb, param ) == INVALID_PARAM ) {
|
if ( isValidParam( pb, param ) == INVALID_PARAM ) {
|
||||||
return PBLOCK_ERROR;
|
return PBLOCK_ERROR;
|
||||||
|
|
@ -281,6 +281,17 @@ set( Slapi_PBlock *pb, int param, void *val )
|
||||||
return PBLOCK_ERROR;
|
return PBLOCK_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch ( param ) {
|
||||||
|
case SLAPI_CONN_DN:
|
||||||
|
case SLAPI_CONN_AUTHMETHOD:
|
||||||
|
case SLAPI_IBM_CONN_DN_ALT:
|
||||||
|
case SLAPI_IBM_CONN_DN_ORIG:
|
||||||
|
case SLAPI_RESULT_TEXT:
|
||||||
|
case SLAPI_RESULT_MATCHED:
|
||||||
|
freeit = 1; break;
|
||||||
|
default:
|
||||||
|
freeit = 0; break;
|
||||||
|
}
|
||||||
for( i = 0; i < pb->numParams; i++ ) {
|
for( i = 0; i < pb->numParams; i++ ) {
|
||||||
if ( pb->curParams[i] == param ) {
|
if ( pb->curParams[i] == param ) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -291,6 +302,7 @@ set( Slapi_PBlock *pb, int param, void *val )
|
||||||
pb->curParams[i] = param;
|
pb->curParams[i] = param;
|
||||||
pb->numParams++;
|
pb->numParams++;
|
||||||
}
|
}
|
||||||
|
if ( freeit ) ch_free( pb->curVals[i] );
|
||||||
pb->curVals[i] = val;
|
pb->curVals[i] = val;
|
||||||
|
|
||||||
unLock( pb );
|
unLock( pb );
|
||||||
|
|
|
||||||
|
|
@ -2244,13 +2244,15 @@ static int initConnectionPB( Slapi_PBlock *pb, Connection *conn )
|
||||||
0 );
|
0 );
|
||||||
if ( connAuthType != NULL ) {
|
if ( connAuthType != NULL ) {
|
||||||
rc = slapi_pblock_set(pb, SLAPI_CONN_AUTHMETHOD, (void *)connAuthType);
|
rc = slapi_pblock_set(pb, SLAPI_CONN_AUTHMETHOD, (void *)connAuthType);
|
||||||
|
/* slapi_pblock_set dups this itself */
|
||||||
|
slapi_ch_free( (void **)&connAuthType );
|
||||||
if ( rc != LDAP_SUCCESS )
|
if ( rc != LDAP_SUCCESS )
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( conn->c_authz.sai_dn.bv_val != NULL ) {
|
if ( conn->c_authz.sai_dn.bv_val != NULL ) {
|
||||||
char *connDn = slapi_ch_strdup(conn->c_authz.sai_dn.bv_val);
|
/* slapi_pblock_set dups this itself */
|
||||||
rc = slapi_pblock_set(pb, SLAPI_CONN_DN, (void *)connDn);
|
rc = slapi_pblock_set(pb, SLAPI_CONN_DN, (void *)conn->c_authz.sai_dn.bv_val);
|
||||||
if ( rc != LDAP_SUCCESS )
|
if ( rc != LDAP_SUCCESS )
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -3741,8 +3743,6 @@ int slapi_x_access_allowed( Operation *op,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
slapi_x_pblock_set_operation( op->o_pb, op );
|
|
||||||
|
|
||||||
switch ( access ) {
|
switch ( access ) {
|
||||||
case ACL_WRITE:
|
case ACL_WRITE:
|
||||||
slap_access |= SLAPI_ACL_ADD | SLAPI_ACL_DELETE | SLAPI_ACL_WRITE;
|
slap_access |= SLAPI_ACL_ADD | SLAPI_ACL_DELETE | SLAPI_ACL_WRITE;
|
||||||
|
|
@ -3766,6 +3766,8 @@ int slapi_x_access_allowed( Operation *op,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slapi_x_pblock_set_operation( op->o_pb, op );
|
||||||
|
|
||||||
rc = 1; /* default allow policy */
|
rc = 1; /* default allow policy */
|
||||||
|
|
||||||
for ( pGetPlugin = tmpPlugin; *pGetPlugin != NULL; pGetPlugin++ ) {
|
for ( pGetPlugin = tmpPlugin; *pGetPlugin != NULL; pGetPlugin++ ) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue