Hi,

Quoting Chris Hofstaedtler (2025-01-26 22:38:31)
> > Don't know why it built on x86-conova-02 for i386.
> 
> Still unclear to me.
> 
> Might be a good idea to zero-initialize the "info" pointer.

I have no idea why I was in CC but I also got the segmentation fault on my
laptop (arm64) and this patch fixed it:

--- a/src/folia_utils.cxx
+++ b/src/folia_utils.cxx
@@ -688,7 +688,7 @@ namespace folia {
       \return a string with the hostname
     */
     string result = "unknown";
-    struct addrinfo hints, *info;
+    struct addrinfo hints, *info = NULL;
     int gai_result;
 
     char hostname[1024];
@@ -706,7 +706,8 @@ namespace folia {
     if ((gai_result = getaddrinfo(hostname, "http", &hints, &info)) != 0) {
       //      cerr << "getaddrinfo failed: " << gai_strerror(gai_result)
       //          << ", using 'unknown' as hostname" << endl;
-      freeaddrinfo(info);
+      if (info != NULL)
+        freeaddrinfo(info);
       result = hostname;
       return result;
     }


Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

-- 
debian-science-maintainers mailing list
debian-science-maintainers@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-science-maintainers

Reply via email to