From 5c6728fc5ef2f458e733bd94668bcc14944a718d Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 17 Feb 2024 18:49:31 +0100 Subject: [PATCH] musl regtest: fix crash in helgrind getaddrinfo musl doesn't like it if you pass in NULL to freeaddrinfo. --- helgrind/tests/getaddrinfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helgrind/tests/getaddrinfo.c b/helgrind/tests/getaddrinfo.c index 9c9bcc1c5c..fc3b0a9d56 100644 --- a/helgrind/tests/getaddrinfo.c +++ b/helgrind/tests/getaddrinfo.c @@ -34,7 +34,11 @@ int main(void) { } for (i = 0; i < threaddat_size; ++i) { pthread_join(threads[i], 0); - freeaddrinfo(threaddat[i].res); + // musl crashes if you pass a NULL pointer to freeaddrinfo + if (threaddat[i].res) + { + freeaddrinfo(threaddat[i].res); + } } return 0; } -- 2.47.2