diff options
author | Justin Brewer <jzb0012@auburn.edu> | 2018-04-17 13:47:51 -0500 |
---|---|---|
committer | Justin Brewer <jzb0012@auburn.edu> | 2018-04-30 21:45:13 -0500 |
commit | 546d9415e1806565b6c8f413c8873726c6aa049f (patch) | |
tree | 44fab65834361549a72ddabb7ae6f37fe9143f19 | |
parent | d1c1b668c14dced57026aca936a57c2567f65107 (diff) |
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 d4b715f0aa97 ("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: Justin Brewer <jzb0012@auburn.edu>
-rw-r--r-- | net.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 } |