🧪 test(glimpse_detector test case): fix memleak when commit json
This commit is contained in:
@@ -104,6 +104,7 @@ static void publish_session_test_result(struct glimpse_detector_test_plugin_env
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
session_mq_publish_message(sess, env->expect_json_topic_id, cJSON_Print(ctx));
|
session_mq_publish_message(sess, env->expect_json_topic_id, cJSON_Print(ctx));
|
||||||
|
cJSON_Delete(ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,6 +186,10 @@ extern "C" void *GLIMPSE_DETECTOR_TEST_PLUG_LOAD(struct stellar *st)
|
|||||||
extern "C" void GLIMPSE_DETECTOR_TEST_PLUG_UNLOAD(void *plugin_env)
|
extern "C" void GLIMPSE_DETECTOR_TEST_PLUG_UNLOAD(void *plugin_env)
|
||||||
{
|
{
|
||||||
struct glimpse_detector_test_plugin_env *env = (struct glimpse_detector_test_plugin_env *)plugin_env;
|
struct glimpse_detector_test_plugin_env *env = (struct glimpse_detector_test_plugin_env *)plugin_env;
|
||||||
|
for(int i = 0; i < MAX_APP_ID_VALUE; i++)
|
||||||
|
{
|
||||||
|
if(env->g_proto_id2name[i])free(env->g_proto_id2name[i]);
|
||||||
|
}
|
||||||
free(env);
|
free(env);
|
||||||
printf("GLIMPSE_DETECTOR_TEST_PLUG_UNLOAD OK!\n");
|
printf("GLIMPSE_DETECTOR_TEST_PLUG_UNLOAD OK!\n");
|
||||||
return ;
|
return ;
|
||||||
|
|||||||
Reference in New Issue
Block a user