Commit 191f8031 authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

ITS#7906 fix ppolicy_connection_destroy

It can still run after ppolicy_close has freed the connection table
parent d90895e1
...@@ -1269,7 +1269,7 @@ ppolicy_bind( Operation *op, SlapReply *rs ) ...@@ -1269,7 +1269,7 @@ ppolicy_bind( Operation *op, SlapReply *rs )
static int static int
ppolicy_connection_destroy( BackendDB *bd, Connection *conn ) ppolicy_connection_destroy( BackendDB *bd, Connection *conn )
{ {
if ( !BER_BVISEMPTY( &pwcons[conn->c_conn_idx].dn )) { if ( pwcons && !BER_BVISEMPTY( &pwcons[conn->c_conn_idx].dn )) {
ch_free( pwcons[conn->c_conn_idx].dn.bv_val ); ch_free( pwcons[conn->c_conn_idx].dn.bv_val );
BER_BVZERO( &pwcons[conn->c_conn_idx].dn ); BER_BVZERO( &pwcons[conn->c_conn_idx].dn );
} }
...@@ -2330,9 +2330,10 @@ ppolicy_close( ...@@ -2330,9 +2330,10 @@ ppolicy_close(
/* Perhaps backover should provide bi_destroy hooks... */ /* Perhaps backover should provide bi_destroy hooks... */
ov_count--; ov_count--;
if ( ov_count <=0 && pwcons ) { if ( ov_count <=0 && pwcons ) {
pwcons--; pw_conn *pwc = pwcons;
free( pwcons );
pwcons = NULL; pwcons = NULL;
pwc--;
ch_free( pwc );
} }
free( pi->def_policy.bv_val ); free( pi->def_policy.bv_val );
free( pi ); free( pi );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment