diff mbox

[2/4] gtphub_unmap_header_tei(): don't dereference unmapped_tei arg if not present (CID #57687)

Message ID 1460640093-22167-3-git-send-email-nhofmeyr@sysmocom.de
State Not Applicable
Headers show

Commit Message

Neels Hofmeyr April 14, 2016, 1:21 p.m. UTC
---
 openbsc/src/gprs/gtphub.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index e8bd3ae..58300ea 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -1434,14 +1434,16 @@  static int gtphub_unmap_header_tei(struct gtphub_peer_port **to_port_p,
 		    p->header_tei_rx, gtphub_port_str(from_port));
 		return -1;
 	}
-	OSMO_ASSERT(*unmapped_from_tun);
+
+	if (unmapped_from_tun) {
+		OSMO_ASSERT(*unmapped_from_tun);
+		LOG(LOGL_DEBUG, "Unmapped TEI coming from: %s\n",
+		    gtphub_tunnel_str(*unmapped_from_tun));
+	}
 
 	uint32_t unmapped_tei = to->tei_orig;
 	set_tei(p, unmapped_tei);
 
-	LOG(LOGL_DEBUG, "Unmapped TEI coming from: %s\n",
-	    gtphub_tunnel_str(*unmapped_from_tun));
-
 	/* May be NULL for an invalidated tunnel. */
 	*to_port_p = to->peer;