diff options
author | David Bauer <mail@david-bauer.net> | 2019-07-25 18:51:25 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2019-07-25 20:45:54 +0200 |
commit | 7d9f90ebe9dd3a7f6af1fbb97d8cc228fb0fded4 (patch) | |
tree | 7bc547ac509731f742dd19c7b985103881b6ebbb | |
parent | 5cb3bf654a762d797f94d9aca2d56484b3b0ed75 (diff) | |
download | fastd-master.tar fastd-master.zip |
When compiled with musl >1.1.20, fastd will crash in case it can't
resolve a peers hostname. This is due to a changed implementation of
freeaddrinfo in musl 1.1.21 onwards.
This segfault is fixed by not calling freeaddrinfo in case the supplied
pointer is null.
Signed-off-by: David Bauer <mail@david-bauer.net>
-rw-r--r-- | src/resolve.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/resolve.c b/src/resolve.c index 9bdfa1c..bfd2a59 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -104,7 +104,9 @@ static void * resolve_peer(void *varg) { fastd_async_enqueue(ASYNC_TYPE_RESOLVE_RETURN, ret, sizeof(fastd_async_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t)); - freeaddrinfo(res); + if (res) + freeaddrinfo(res); + free(arg->hostname); free(arg); |