[PATCH] osmo-sgsn[master]: gbproxy: check peer allocation 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/.

Max gerrit-no-reply at lists.osmocom.org
Mon Sep 18 14:12:40 UTC 2017


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

gbproxy: check peer allocation result

gbproxy_peer_alloc() could return NULL which wasn't checked. Fix it and
add corresponding error log. While at it, also format log messages
consistently.

Change-Id: Ib10c954e17a479baef31ded54370b35938e00018
---
M src/gprs/gb_proxy.c
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/77/3977/1

diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c
index eb2bbcc..c64dc8c 100644
--- a/src/gprs/gb_proxy.c
+++ b/src/gprs/gb_proxy.c
@@ -1018,9 +1018,14 @@
 			if (!from_peer) {
 				/* if a PTP-BVC is reset, and we don't know that
 				 * PTP-BVCI yet, we should allocate a new peer */
-				LOGP(DGPRS, LOGL_INFO, "Allocationg new peer for "
-				     "BVCI=%u via NSEI=%u\n", bvci, nsei);
+				LOGP(DGPRS, LOGL_INFO, "Allocationg new peer for BVCI=%u via NSEI=%u\n", bvci, nsei);
 				from_peer = gbproxy_peer_alloc(cfg, bvci);
+				if (!from_peer) {
+					LOGP(DGPRS, LOGL_ERROR, "Failed to allocate new peer for BVCI=%u via NSEI=%u\n",
+					     bvci, nsei);
+
+					return -ENOMEM;
+				}
 				from_peer->nsei = nsei;
 			}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib10c954e17a479baef31ded54370b35938e00018
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list