fix memory leak in tests

This commit is contained in:
lixianjing 2025-04-16 08:26:01 +08:00
parent 05ae3ef044
commit 5394a511e5
2 changed files with 2 additions and 0 deletions

View File

@ -203,6 +203,7 @@ static ret_t foo_service_dispatch(foo_service_t* foo) {
static ret_t foo_service_destroy(foo_service_t* foo) {
return_value_if_fail(foo != NULL, RET_BAD_PARAMS);
str_reset(&foo->str);
memset(foo, 0x00, sizeof(*foo));
TKMEM_FREE(foo);

View File

@ -97,6 +97,7 @@ static void test_foo(uint32_t retry_times, foo_service_args_t* args) {
str_reset(&str);
tk_service_destroy(service);
foo_client_destroy(client);
tk_thread_destroy(thread);
}
TEST(foo, retry_times0) {