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.
This commit is contained in:
2026-05-15 01:50:08 +00:00
parent 3c021c754d
commit 360c5fb0a9

View File

@@ -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();
}