"src/parser.h" did not exist on "b852caf34519547388c309166d127f2e547d3497"
Commit 546d9415 authored by Justin Brewer's avatar Justin Brewer
Browse files

Fix a segfault on *BSD

freeaddrinfo is not required by POSIX to be NULL-safe. OpenBSD will
SIGSEGV. NetBSD will assert. FreeBSD up to 11.1 will SIGSEGV, while in
future versions, it will be a silent NOP [1].

Commit d4b715f0 ("Fix potential race in 'invalid timeout' tests")
added a code path to _redisContextConnectTcp which calls
freeaddrinfo(NULL), triggering the segfault. Put a NULL check around the
call to freeaddrinfo.

[1] - https://github.com/freebsd/freebsd/commit/e9167239034a1e475c3238f8d133ebf703424ee0

Signed-off-by: default avatarJustin Brewer <jzb0012@auburn.edu>
parent d1c1b668
......@@ -412,7 +412,10 @@ addrretry:
error:
rv = REDIS_ERR;
end:
freeaddrinfo(servinfo);
if(servinfo) {
freeaddrinfo(servinfo);
}
return rv; // Need to return REDIS_OK if alright
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment