diff --git a/tests/test_providers.c b/tests/test_providers.c index 5df66cf..586c8db 100644 --- a/tests/test_providers.c +++ b/tests/test_providers.c @@ -197,9 +197,12 @@ main(void) mf = fopen(mpath, "r"); CHECK(mf != NULL); if (mf != NULL) { - mbuf[0] = '\0'; - (void)fread(mbuf, 1, sizeof(mbuf) - 1, mf); - mbuf[sizeof(mbuf) - 1] = '\0'; + size_t got; + + /* terminate where the read stopped: the rest of the + * buffer is not text, and strstr() would walk into it */ + got = fread(mbuf, 1, sizeof(mbuf) - 1, mf); + mbuf[got] = '\0'; fclose(mf); /* the choice is a default; the provider carries the rest */ CHECK(strstr(mbuf, "default = ocgo/other-model") != NULL); diff --git a/tests/test_skills.c b/tests/test_skills.c index abc4d96..63ca5c7 100644 --- a/tests/test_skills.c +++ b/tests/test_skills.c @@ -98,6 +98,9 @@ main(void) CHECK(strstr(out.p, "no skill 'nope'") != NULL); sp_buf_free(&out); + /* the registry owns what sp_registry_add copied: free it, or the + * test leaks what production never does */ + sp_registry_free(&r); { char cmd[700];