diff options
| author | yangwei <[email protected]> | 2024-07-23 18:03:15 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-07-23 18:14:04 +0800 |
| commit | a91425ce46fdf3459924f6463af533ac8d2f3ce0 (patch) | |
| tree | 99f16c68b6cc8e3c795451715d8aaedcac88e19f /src | |
| parent | e94c0f07702b003f6db0d57292f3200906e02bef (diff) | |
🐞 fix(plugin manager): forbidden exdata op in free_cb
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugin_manager/plugin_manager.c | 5 | ||||
| -rw-r--r-- | src/plugin_manager/plugin_manager_interna.h | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/plugin_manager/plugin_manager.c b/src/plugin_manager/plugin_manager.c index 7ab8f99..a1c1d84 100644 --- a/src/plugin_manager/plugin_manager.c +++ b/src/plugin_manager/plugin_manager.c @@ -231,6 +231,7 @@ int stellar_exdata_set(UT_array *exdata_schema, struct stellar_exdata *exdata_ar if(exdata_schema == NULL|| exdata_array == NULL)return -1; unsigned int len=utarray_len(exdata_schema); if(len < (unsigned int)idx)return -1; + if((exdata_array+idx)->state == EXIT)return -1; (exdata_array+idx)->exdata=ex_ptr; return 0; } @@ -240,6 +241,7 @@ void *stellar_exdata_get(UT_array *exdata_schema, struct stellar_exdata *exdata_ if(exdata_schema == NULL|| exdata_array == NULL)return NULL; unsigned int len = utarray_len(exdata_schema); if(len < (unsigned int)idx)return NULL; + if((exdata_array+idx)->state == EXIT)return NULL; return (exdata_array+idx)->exdata; } @@ -267,6 +269,7 @@ static void per_thread_packet_exdata_arrary_clean(struct plugin_manager_schema * for (unsigned int i = 0; i < len; i++) { void *exdata = (per_thread_pkt_exdata_arrary + i)->exdata; + (per_thread_pkt_exdata_arrary + i)->state=EXIT; struct stellar_exdata_schema *schema = (struct stellar_exdata_schema *)utarray_eltptr(plug_mgr->packet_exdata_schema_array, i); if (exdata) { @@ -276,6 +279,7 @@ static void per_thread_packet_exdata_arrary_clean(struct plugin_manager_schema * } (per_thread_pkt_exdata_arrary + i)->exdata=NULL; } + (per_thread_pkt_exdata_arrary + i)->state=INIT; } } @@ -847,6 +851,7 @@ static void session_exdata_runtime_free(struct plugin_manager_schema *plug_mgr, for (unsigned int i = 0; i < len; i++) { void *exdata = (exdata_rt + i)->exdata; + (exdata_rt + i)->state=EXIT; struct stellar_exdata_schema *schema = (struct stellar_exdata_schema *)utarray_eltptr(plug_mgr->session_exdata_schema_array, i); if (exdata) { diff --git a/src/plugin_manager/plugin_manager_interna.h b/src/plugin_manager/plugin_manager_interna.h index abb2e5d..6ea3804 100644 --- a/src/plugin_manager/plugin_manager_interna.h +++ b/src/plugin_manager/plugin_manager_interna.h @@ -53,10 +53,13 @@ struct plugin_manager_schema struct plugin_manger_per_thread_data *per_thread_data; }__attribute__((aligned(sizeof(void*)))); +enum plugin_exdata_state +{ INIT, ACTIVE, EXIT }; struct stellar_exdata { void *exdata; + enum plugin_exdata_state state; }; @@ -124,8 +127,7 @@ struct stellar_mq_topic_schema struct stellar_mq_subscriber *subscribers; }__attribute__((aligned(sizeof(void*)))); -enum plugin_exdata_state -{ INIT, ACTIVE, EXIT }; + struct session_plugin_ctx_runtime { |
