SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, (void *)tp );\r
slapi_pblock_set( (Slapi_PBlock *)op->o_pb,\r
SLAPI_NENTRIES, (void *)i );\r
- slapi_ch_free( ent2str );\r
+ slapi_ch_free( (void **)&ent2str );\r
\r
return LDAP_SUCCESS;\r
}\r
pConn->c_pending_ops.stqh_first =\r
(Operation *) slapi_ch_calloc( 1, sizeof(Operation) );\r
if ( pConn->c_pending_ops.stqh_first == NULL ) { \r
- slapi_ch_free( pConn );\r
+ slapi_ch_free( (void **)&pConn );\r
return (Connection *)NULL;\r
}\r
\r
pConn->c_pending_ops.stqh_first->o_pb = \r
(Slapi_PBlock *) slapi_pblock_new();\r
if ( pConn->c_pending_ops.stqh_first->o_pb == NULL ) {\r
- slapi_ch_free( pConn->c_pending_ops.stqh_first );\r
- slapi_ch_free( pConn );\r
+ slapi_ch_free( (void **)&pConn->c_pending_ops.stqh_first );\r
+ slapi_ch_free( (void **)&pConn );\r
return (Connection *)NULL;\r
}\r
\r
\r
cleanup:\r
\r
- if ( dn.bv_val ) slapi_ch_free( dn.bv_val );\r
- if ( op ) slapi_ch_free( op );\r
+ if ( dn.bv_val ) slapi_ch_free( (void **)&dn.bv_val );\r
+ if ( op ) slapi_ch_free( (void **)&op );\r
if ( modlist != NULL ) slap_mods_free( modlist );\r
if ( rc != LDAP_SUCCESS ) {\r
if ( pEntry != NULL ) {\r
if (pPB != NULL) \r
slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rc );\r
\r
- if (dn.bv_val) slapi_ch_free(dn.bv_val);\r
- if (pdn.bv_val) slapi_ch_free(pdn.bv_val);\r
- if (ndn.bv_val) slapi_ch_free(ndn.bv_val);\r
+ if (dn.bv_val) slapi_ch_free( (void **)&dn.bv_val );\r
+ if (pdn.bv_val) slapi_ch_free( (void **)&pdn.bv_val );\r
+ if (ndn.bv_val) slapi_ch_free( (void **)&ndn.bv_val );\r
\r
if ( pConn != NULL ) {\r
- if ( pConn->c_dn.bv_val ) slapi_ch_free( pConn->c_dn.bv_val );\r
- if ( op->o_dn.bv_val ) slapi_ch_free( op->o_dn.bv_val );\r
- if ( op ) slapi_ch_free( op );\r
+ if ( pConn->c_dn.bv_val ) slapi_ch_free( (void **)&pConn->c_dn.bv_val );\r
+ if ( op->o_dn.bv_val ) slapi_ch_free( (void **)&op->o_dn.bv_val );\r
+ if ( op ) slapi_ch_free( (void **)&op );\r
pSavePB = pPB;\r
free( pConn );\r
}\r
}\r
\r
if ( pConn != NULL ) {\r
- if ( pConn->c_dn.bv_val ) slapi_ch_free( pConn->c_dn.bv_val );\r
+ if ( pConn->c_dn.bv_val ) slapi_ch_free( (void **)&pConn->c_dn.bv_val );\r
if ( op ) {\r
if ( op->o_ndn.bv_val ) {\r
- slapi_ch_free( op->o_ndn.bv_val );\r
+ slapi_ch_free( (void **)&op->o_ndn.bv_val );\r
}\r
free(op);\r
}\r
if ( nnewrdn.bv_val ) ch_free( newrdn.bv_val );\r
\r
if ( pConn != NULL ) {\r
- if ( pConn->c_dn.bv_val ) slapi_ch_free( pConn->c_dn.bv_val );\r
+ if ( pConn->c_dn.bv_val ) slapi_ch_free( (void **)&pConn->c_dn.bv_val );\r
if ( op ) {\r
- if ( op->o_dn.bv_val ) slapi_ch_free( op->o_dn.bv_val );\r
- slapi_ch_free( op );\r
+ if ( op->o_dn.bv_val ) slapi_ch_free( (void **)&op->o_dn.bv_val );\r
+ slapi_ch_free( (void **)&op );\r
}\r
pSavePB = pPB;\r
free( pConn );\r
if ( modlist != NULL ) slap_mods_free( modlist );\r
\r
if ( pConn != NULL ) {\r
- if ( pConn->c_dn.bv_val ) slapi_ch_free( pConn->c_dn.bv_val );\r
+ if ( pConn->c_dn.bv_val ) slapi_ch_free( (void **)&pConn->c_dn.bv_val );\r
if ( op ) {\r
- if ( op->o_dn.bv_val ) slapi_ch_free( op->o_dn.bv_val );\r
- slapi_ch_free( op );\r
+ if ( op->o_dn.bv_val ) slapi_ch_free( (void **)&op->o_dn.bv_val );\r
+ slapi_ch_free( (void **)&op );\r
}\r
pSavePB = pPB;\r
free( pConn );\r
if ( an != NULL ) free( an );\r
\r
if ( c != NULL ) {\r
- if ( c->c_dn.bv_val ) slapi_ch_free( c->c_dn.bv_val );\r
+ if ( c->c_dn.bv_val ) slapi_ch_free( (void **)&c->c_dn.bv_val );\r
if ( op ) {\r
- if ( op->o_ndn.bv_val ) slapi_ch_free( op->o_ndn.bv_val );\r
+ if ( op->o_ndn.bv_val ) slapi_ch_free( (void **)&op->o_ndn.bv_val );\r
free( op );\r
}\r
pSavePB = ptr;\r
pTmpS = slapi_ch_strdup( s );
if ( pTmpS != NULL ) {
e = str2entry( pTmpS );
- slapi_ch_free( pTmpS );
+ slapi_ch_free( (void **)&pTmpS );
}
return e;
tmpEnt = (Slapi_Entry *)str2entry( tmp );
if ( tmpEnt == NULL ) {
- slapi_ch_free( tmp );
+ slapi_ch_free( (void **)&tmp );
return (Slapi_Entry *)NULL;
}
if (tmp != NULL) {
- slapi_ch_free( tmp );
+ slapi_ch_free( (void **)&tmp );
}
return tmpEnt;
}
void
-slapi_ch_free( void *ptr )
+slapi_ch_free( void **ptr )
{
#if defined(LDAP_SLAPI)
-#if 0
- if ( ptr != NULL ) /* not required ... */
-#endif /* 0 */
- ch_free( ptr );
+ ch_free( *ptr );
+ *ptr = NULL;
#endif /* defined(LDAP_SLAPI) */
}
if ( val ) {
*val = pTmpBval;
} else {
- slapi_ch_free( pTmpBval );
+ slapi_ch_free( (void **)&pTmpBval );
rc = 0;
}
}
} else if ( sysinfo( SI_HOSTNAME, hn, MAX_HOSTNAME ) < 0 ) {
slapi_log_error( SLAPI_LOG_FATAL, "SLAPI_SYSINFO",
"can't get hostname\n" );
- slapi_ch_free( hn );
+ slapi_ch_free( (void **)&hn );
hn = NULL;
}
#else /* !_SPARC */
slapi_log_error( SLAPI_LOG_FATAL,
"SLAPI_SYSINFO",
"can't get hostname\n" );
- slapi_ch_free( static_hn );
+ slapi_ch_free( (void **)&static_hn );
static_hn = NULL;
ldap_pvt_thread_mutex_unlock( &slapi_hn_mutex );
slapi_entry_free( entries[k] );
}
- slapi_ch_free( entries );
+ slapi_ch_free( (void **)&entries );
#endif /* defined(LDAP_SLAPI) */
}