From 360c5fb0a9a2472d8593a7fa654d100573c56866 Mon Sep 17 00:00:00 2001 From: Jabber Developer Date: Fri, 15 May 2026 01:50:08 +0000 Subject: [PATCH] tests(ai_client): remove redundant ai_provider_unref() before ai_client_shutdown() The tests called ai_provider_unref(provider) on providers owned by the hash table, then called ai_client_shutdown() which destroys the hash table and calls ai_provider_unref() again on the same dangling pointer. This caused Invalid read of size 4 at ai_client.c:302. Fix by removing the redundant unref calls - ai_client_shutdown() cleans up all providers in the hash table automatically. --- tests/unittests/test_ai_client.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unittests/test_ai_client.c b/tests/unittests/test_ai_client.c index 20783f17..169c845b 100644 --- a/tests/unittests/test_ai_client.c +++ b/tests/unittests/test_ai_client.c @@ -704,7 +704,6 @@ test_ai_parse_models_openai_format(void** state) models = g_list_next(models); assert_string_equal("google/gemini-3-flash-preview", models->data); - ai_provider_unref(provider); ai_client_shutdown(); } @@ -777,7 +776,6 @@ test_ai_parse_models_perplexity_format(void** state) models = g_list_last(models); assert_string_equal("xai/grok-4.3", models->data); - ai_provider_unref(provider); ai_client_shutdown(); } @@ -802,7 +800,6 @@ test_ai_parse_models_array_format(void** state) models = g_list_next(models); assert_string_equal("model3", models->data); - ai_provider_unref(provider); ai_client_shutdown(); }