unit-tests: Zero-initialize chunk to avoid free on non-successful fetch
authorMartin Willi <martin@revosec.ch>
Mon, 2 Jun 2014 10:52:32 +0000 (12:52 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 14:34:16 +0000 (16:34 +0200)
If the fetch fails, the fetcher is not required to return an empty chunk. Avoid
the resulting invalid free() by initializing data.ptr to NULL.

src/libstrongswan/tests/suites/test_fetch_http.c

index 42743c7..9f1eef2 100644 (file)
@@ -281,7 +281,7 @@ START_TEST(test_response_code)
 {
        stream_service_t *service;
        status_t status;
-       chunk_t data;
+       chunk_t data = chunk_empty;
        char uri[256];
        u_int code;