[PATCH] osmo-pcap[master]: sock_src_init(): Don't freeaddrinfo() undefined src_result

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jul 21 11:11:31 UTC 2017


Review at  https://gerrit.osmocom.org/3324

sock_src_init(): Don't freeaddrinfo() undefined src_result

src_result is only valid "if (src)", so we cannot unconditionally
free it:

(gdb) bt
    host=0x52 <error: Cannot access memory at address 0x52>, src=0x0)
    at /usr/src/debug/osmo-pcap/0.0.6+gitrAUTOINC+4776b2972e-r1d/git/src/osmo_client_network.c:165

Change-Id: I3b6778d9110583ecb1daec59ef2c86465d5818b9
---
M src/osmo_client_network.c
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/24/3324/1

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",

-- 
To view, visit https://gerrit.osmocom.org/3324
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b6778d9110583ecb1daec59ef2c86465d5818b9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list