ssl policy使用gcc __sync_add_and_fetch操作引用计数,fix #150
This commit is contained in:
@@ -38,14 +38,14 @@ struct intercept_param
|
||||
void intercept_param_dup_cb(int table_id, MAAT_PLUGIN_EX_DATA* to, MAAT_PLUGIN_EX_DATA* from, long argl, void* argp)
|
||||
{
|
||||
struct intercept_param* param= (struct intercept_param*) *from;
|
||||
if(param==NULL)
|
||||
if(param)
|
||||
{
|
||||
*to=NULL;
|
||||
__sync_add_and_fetch(&(param->ref_cnt), 1);
|
||||
*to = param;
|
||||
}
|
||||
else
|
||||
{
|
||||
param->ref_cnt++;
|
||||
*to = param;
|
||||
*to=NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -171,8 +171,8 @@ void intercept_param_free_cb(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, v
|
||||
{
|
||||
return;
|
||||
}
|
||||
param->ref_cnt--;
|
||||
if(param->ref_cnt==0)
|
||||
|
||||
if ((__sync_sub_and_fetch(¶m->ref_cnt, 1) == 0))
|
||||
{
|
||||
TFE_LOG_INFO(enforcer->logger, "Del intercept policy %d", param->policy_id);\
|
||||
free(param);
|
||||
|
||||
Reference in New Issue
Block a user