]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
musl regtest: fix crash in helgrind getaddrinfo
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 17 Feb 2024 17:49:31 +0000 (18:49 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 17 Feb 2024 17:49:31 +0000 (18:49 +0100)
musl doesn't like it if you pass in NULL to freeaddrinfo.

helgrind/tests/getaddrinfo.c

index 9c9bcc1c5c59f71ec3ce3be2a016e4339165c82c..fc3b0a9d5692ec10128c0a8b613ea21f0dbd9f33 100644 (file)
@@ -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;
 }