From: Martin Willi Date: Mon, 2 Jun 2014 10:52:32 +0000 (+0200) Subject: unit-tests: Zero-initialize chunk to avoid free on non-successful fetch X-Git-Tag: 5.2.0dr6~21^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74eedc8061fd2994be1ff3460c54f8cb65273b43;p=thirdparty%2Fstrongswan.git unit-tests: Zero-initialize chunk to avoid free on non-successful fetch 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. --- diff --git a/src/libstrongswan/tests/suites/test_fetch_http.c b/src/libstrongswan/tests/suites/test_fetch_http.c index 42743c7872..9f1eef2f37 100644 --- a/src/libstrongswan/tests/suites/test_fetch_http.c +++ b/src/libstrongswan/tests/suites/test_fetch_http.c @@ -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;