Message ID | gerrit.1500635490647.I3b6778d9110583ecb1daec59ef2c86465d5818b9@gerrit.osmocom.org |
---|---|
State | New |
Headers | show |
Patch Set 1: Code-Review+1 (2 comments) https://gerrit.osmocom.org/#/c/3324/1/src/osmo_client_network.c File src/osmo_client_network.c: Line 47: * Move to libosmocore... if the api makes source s/source/sense/ lol... Line 165: if (src) Why not src_result directly?
Patch Set 1:
(1 comment)
https://gerrit.osmocom.org/#/c/3324/1/src/osmo_client_network.c
File src/osmo_client_network.c:
Line 165: if (src)
> Why not src_result directly?
because it's not initialized with NULL, so we cannot check if it contains random chunk or valid data. Hence I used the same condition that you use before getaddrinfo().
Patch Set 1: Code-Review+2
> (1 comment)
This explains the crash. Do you have a backtrace as well? It would be interesting to see why it is NULL. But very minor issue so let's not lose too much time here.
diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c index 937caa0..27c649a 100644 --- a/src/osmo_client_network.c +++ b/src/osmo_client_network.c @@ -162,7 +162,8 @@ close(sfd); } freeaddrinfo(result); - freeaddrinfo(src_result); + if (src) + freeaddrinfo(src_result); if (rp == NULL) { fprintf(stderr, "unable to connect/bind socket: %s:%u: %s\n",