Browse code

core: fix freeaddrinfo coredump

> #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007fbb5e515537 in __GI_abort () at abort.c:79
> #2 0x00007fbb5e56e768 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fbb5e67ce2d "%s\n") at ../sysdeps/posix/libc_fatal.c:155
> #3 0x00007fbb5e575a5a in malloc_printerr (str=str@entry=0x7fbb5e67b05a "free(): invalid pointer") at malloc.c:5347
> #4 0x00007fbb5e576c14 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:4173
> #5 0x00007fbb5e5d8da0 in __GI_freeaddrinfo (ai=ai@entry=0x7fbb5e83ba10) at ../sysdeps/posix/getaddrinfo.c:2520
> #6 0x000055ba099dcd0b in log_init () at core/dprint.c:482
> #7 0x000055ba09970d7a in main (argc=10, argv=0x7ffde85a1788) at main.c:2055

(cherry picked from commit 71502d2bb733340db310bf4e0c47e4b194f49113)

Victor Seva authored on 22/06/2022 10:26:46 • Victor Seva committed on 22/06/2022 10:47:18
Showing 1 changed files
... ...
@@ -459,7 +459,8 @@ static str log_prefix_str = STR_NULL;
459 459
 
460 460
 void log_init(void)
461 461
 {
462
-	struct addrinfo hints, *info;
462
+	struct addrinfo hints;
463
+	struct addrinfo *info = NULL;
463 464
 	int gai_result;
464 465
 	char hostname[1024];
465 466