Change in openbsc[master]: bsc_filter.c: Return NULL instead of zero in bsc_nat_parse

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed May 1 20:30:48 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/13836


Change subject: bsc_filter.c: Return NULL instead of zero in bsc_nat_parse
......................................................................

bsc_filter.c: Return NULL instead of zero in bsc_nat_parse

Change-Id: I7a0ca6067bb1708d4aec28f9de166ac7874f8e91
---
M openbsc/src/osmo-bsc_nat/bsc_filter.c
1 file changed, 7 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/36/13836/1

diff --git a/openbsc/src/osmo-bsc_nat/bsc_filter.c b/openbsc/src/osmo-bsc_nat/bsc_filter.c
index 432529e..174ec2e 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_filter.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_filter.c
@@ -99,22 +99,19 @@
 	/* do a size check on the input */
 	if (ntohs(hh->len) != msgb_l2len(msg)) {
 		LOGP(DLINP, LOGL_ERROR, "Wrong input length?\n");
-		talloc_free(parsed);
-		return NULL;
+		goto err_free;
 	}
 
 	/* analyze sccp down here */
 	if (parsed->ipa_proto == IPAC_PROTO_SCCP) {
 		memset(&result, 0, sizeof(result));
 		if (sccp_parse_header(msg, &result) != 0) {
-			talloc_free(parsed);
-			return 0;
+			goto err_free;
 		}
 
 		if (msg->l3h && msgb_l3len(msg) < 3) {
 			LOGP(DNAT, LOGL_ERROR, "Not enough space or GSM payload\n");
-			talloc_free(parsed);
-			return 0;
+			goto err_free;
 		}
 
 		parsed->sccp_type = sccp_determine_msg_type(msg);
@@ -133,6 +130,10 @@
 	}
 
 	return parsed;
+
+err_free:
+	talloc_free(parsed);
+	return NULL;
 }
 
 /* Returns 0 if message is whitelisted (has to beforwarded by bsc-nat), 1 if

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

Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a0ca6067bb1708d4aec28f9de166ac7874f8e91
Gerrit-Change-Number: 13836
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190501/816009cd/attachment.htm>


More information about the gerrit-log mailing list