summaryrefslogtreecommitdiff
path: root/shaping/src/shaper.cpp
diff options
context:
space:
mode:
authorroot <[email protected]>2023-06-01 01:37:54 +0000
committerroot <[email protected]>2023-06-01 01:37:54 +0000
commite3f372d425cc86ea44562dc70310f4dfa10fc4b0 (patch)
treeaf237722c052b8838e3479675148b287ca3a0f55 /shaping/src/shaper.cpp
parent09e2ba9d1f615739b9127e096bf638dbd45ceb63 (diff)
free cb_arg at the last
Diffstat (limited to 'shaping/src/shaper.cpp')
-rw-r--r--shaping/src/shaper.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp
index 69c691a..6ca182d 100644
--- a/shaping/src/shaper.cpp
+++ b/shaping/src/shaper.cpp
@@ -421,9 +421,10 @@ static void shaper_token_get_cb(const struct swarmkv_reply *reply, void * cb_arg
shaper_deposit_token_add(s_pf_info, reply->integer, arg->direction);//deposit tokens to profile
END:
- free(cb_arg);
__atomic_sub_fetch(&s_pf_info->async_token_ref_count, 1, __ATOMIC_SEQ_CST);
shaping_flow_free(arg->ctx, sf);//sub ref count and decide if need to free
+ free(cb_arg);
+ cb_arg = NULL;
return;
}
@@ -540,9 +541,10 @@ static void shaper_queue_len_get_cb(const struct swarmkv_reply *reply, void * cb
}
END:
- free(cb_arg);
__atomic_sub_fetch(&s_pf_info->async_queue_len_ref_count, 1, __ATOMIC_SEQ_CST);
shaping_flow_free(arg->ctx, sf);//sub ref count and decide if need to free
+ free(cb_arg);
+ cb_arg = NULL;
}
static int shaper_profile_is_priority_blocked(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, struct shaping_profile_info *profile)