From patchwork Fri Jul 21 11:11:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gerrit-no-reply@lists.osmocom.org X-Patchwork-Id: 792036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.osmocom.org (client-ip=2a01:4f8:191:444b::2:7; helo=lists.osmocom.org; envelope-from=openbsc-bounces@lists.osmocom.org; receiver=) Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3xDSkz6B6fz9sRg for ; Fri, 21 Jul 2017 21:11:39 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 46DF82C668; Fri, 21 Jul 2017 11:11:38 +0000 (UTC) Authentication-Results: lists.osmocom.org; dmarc=none header.from=lists.osmocom.org X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from 127.0.1.12 (unknown [127.0.1.12]) by lists.osmocom.org (Postfix) with ESMTPA id 112462C60E; Fri, 21 Jul 2017 11:11:31 +0000 (UTC) Authentication-Results: lists.osmocom.org; dmarc=none header.from=lists.osmocom.org Authentication-Results: lists.osmocom.org; spf=pass smtp.mailfrom=gerrit-no-reply@lists.osmocom.org Date: Fri, 21 Jul 2017 11:11:31 +0000 From: Harald Welte Message-ID: X-Gerrit-MessageType: newchange Subject: [PATCH] osmo-pcap[master]: sock_src_init(): Don't freeaddrinfo() undefined src_result X-Gerrit-Change-Id: I3b6778d9110583ecb1daec59ef2c86465d5818b9 X-Gerrit-ChangeURL: X-Gerrit-Commit: 604e0711596e7e06600a2d7aea3394d36e5d3bda MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.7-12-gce79992aba X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: laforge@gnumonks.org Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" 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 , 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",