Change in libosmocore[master]: deal with rate_ctr_group_alloc() returning NULL

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 8 22:18:25 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13913 )

Change subject: deal with rate_ctr_group_alloc() returning NULL
......................................................................

deal with rate_ctr_group_alloc() returning NULL

Change-Id: I47d6623b9eca704e3c2537cfb5799a4c0749a7bc
Related: #3701
---
M src/gb/gprs_bssgp.c
M src/gb/gprs_ns.c
2 files changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Verified
  Vadim Yanitskiy: Looks good to me, approved



diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 550757f..b695c28 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -128,6 +128,10 @@
 	ctx->nsei = nsei;
 	/* FIXME: BVCI is not unique, only BVCI+NSEI ?!? */
 	ctx->ctrg = rate_ctr_group_alloc(ctx, &bssgp_ctrg_desc, bvci);
+	if (!ctx->ctrg) {
+		talloc_free(ctx);
+		return NULL;
+	}
 	ctx->fc = talloc_zero(ctx, struct bssgp_flow_control);
 	/* cofigure for 2Mbit, 30 packets in queue */
 	bssgp_fc_init(ctx->fc, 100000, 2*1024*1024/8, 30, &_bssgp_tx_dl_ud);
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index d72003e..3679a5b 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -333,6 +333,10 @@
 	nsvc->nsi = nsi;
 	osmo_timer_setup(&nsvc->timer, gprs_ns_timer_cb, nsvc);
 	nsvc->ctrg = rate_ctr_group_alloc(nsvc, &nsvc_ctrg_desc, nsvci);
+	if (!nsvc->ctrg) {
+		talloc_free(nsvc);
+		return NULL;
+	}
 	nsvc->statg = osmo_stat_item_group_alloc(nsvc, &nsvc_statg_desc, nsvci);
 	nsvc->sig_weight = sig_weight;
 	nsvc->data_weight = data_weight;

-- 
To view, visit https://gerrit.osmocom.org/13913
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I47d6623b9eca704e3c2537cfb5799a4c0749a7bc
Gerrit-Change-Number: 13913
Gerrit-PatchSet: 6
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190508/c38becfb/attachment.html>


More information about the gerrit-log mailing list