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

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
Wed May 8 12:04:16 UTC 2019


Harald Welte has uploaded this change for review. ( 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
---
D doc/vty/example.xml
D doc/vty/vtydoc.xsd
M src/gb/gprs_bssgp.c
M src/gb/gprs_ns.c
4 files changed, 8 insertions(+), 68 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/13913/1

diff --git a/doc/vty/example.xml b/doc/vty/example.xml
deleted file mode 100644
index 400c634..0000000
--- a/doc/vty/example.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<vtydoc xmlns="urn:osmocom:xml:libosmocore:vty:doc:1.0">
-    <!-- test a nested hierachy -->
-    <node id="mgcp" name="MGCP Node">
-	<!-- define a command -->
-	<command id="foo_cmd">
-		<doc>General docs</doc>
-		<params>
-			<param name="do" doc="Explain do" />
-			<param name="fo" doc="Explain foo" />
-		</params>
-	</command>
-	<command id="foo_cmd">
-		<doc>General docs</doc>
-		<params>
-			<param name="do" doc="Explain do" />
-			<param name="fo" doc="Explain foo" />
-		</params>
-	</command>
-
-    </node>
-</vtydoc>
diff --git a/doc/vty/vtydoc.xsd b/doc/vty/vtydoc.xsd
deleted file mode 100644
index 53a67a3..0000000
--- a/doc/vty/vtydoc.xsd
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema
-    xmlns="urn:osmocom:xml:libosmocore:vty:doc:1.0"
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    targetNamespace="urn:osmocom:xml:libosmocore:vty:doc:1.0"
-    elementFormDefault="qualified"
-    attributeFormDefault="unqualified">
-
-    <xs:complexType name="ParamType">
-        <xs:attribute name="name" type="xs:string" use="required" />
-        <xs:attribute name="doc" type="xs:string" use="required" />
-    </xs:complexType>
-
-    <xs:complexType name="ParamsType">
-        <xs:sequence>
-            <xs:element name="param" type="ParamType" maxOccurs="unbounded" />
-        </xs:sequence>
-    </xs:complexType>
-
-    <xs:complexType name="CommandType">
-        <xs:sequence>
-            <xs:element name="doc" type="xs:string" minOccurs="0" maxOccurs="1" />
-            <xs:element name="params" type="ParamsType" minOccurs="1" maxOccurs="1"/>
-            <xs:element name="enter" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
-        </xs:sequence>
-        <xs:attribute name="id" type="xs:string" use="required" />
-    </xs:complexType>
-
-    <xs:complexType name="NodeType">
-	<xs:sequence>
-		<xs:element name="command" type="CommandType" minOccurs="0" maxOccurs="unbounded"/>
-	</xs:sequence>
-        <xs:attribute name="id" type="xs:anyURI"/>
-        <xs:attribute name="name" type="xs:string"/>
-    </xs:complexType>
-
-    <!-- the main entry -->
-    <xs:element name="vtydoc">
-        <xs:complexType>
-            <xs:sequence>
-                <xs:element name="node" type="NodeType" minOccurs="0" maxOccurs="unbounded"/>
-            </xs:sequence>
-        </xs:complexType>
-    </xs:element>
-</xs:schema>
-
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: newchange
Gerrit-Change-Id: I47d6623b9eca704e3c2537cfb5799a4c0749a7bc
Gerrit-Change-Number: 13913
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190508/129f4ae7/attachment.htm>


More information about the gerrit-log mailing list