Change in libosmocore[master]: gprs_ns2: allow to use free_vc() with 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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Sun Jan 17 21:43:25 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22274 )


Change subject: gprs_ns2: allow to use free_vc() with NULL
......................................................................

gprs_ns2: allow to use free_vc() with NULL

Usually talloc_free() and other free functions in osmocom allows
to be called with NULL which is then ignored.

Change-Id: If7b0c6916a29d4611d0a40c388414076eb83e6b5
---
M src/gb/gprs_ns2_fr.c
M src/gb/gprs_ns2_udp.c
2 files changed, 5 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/22274/1

diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index c897cbc..746ed62 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -101,7 +101,8 @@
 
 static void free_vc(struct gprs_ns2_vc *nsvc)
 {
-	OSMO_ASSERT(nsvc);
+	if (!nsvc)
+		return;
 
 	if (!nsvc->priv)
 		return;
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index 2a2886a..02a957b 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -73,6 +73,9 @@
 
 static void free_vc(struct gprs_ns2_vc *nsvc)
 {
+	if (!nsvc)
+		return;
+
 	if (!nsvc->priv)
 		return;
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If7b0c6916a29d4611d0a40c388414076eb83e6b5
Gerrit-Change-Number: 22274
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210117/6d2703eb/attachment.htm>


More information about the gerrit-log mailing list