[PATCH] libosmo-sccp[master]: initialize msg->l2h in sccp_msgb_alloc()

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
Sat Nov 11 19:26:35 UTC 2017


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

initialize msg->l2h in sccp_msgb_alloc()

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


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/85/4785/1

diff --git a/src/sua.c b/src/sua.c
index fb7545e..7575021 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -60,10 +60,15 @@
 
 struct msgb *sccp_msgb_alloc(const char *name)
 {
+	struct msgb *msg;
 	if (!name)
 		name = "SCCP";
-	return msgb_alloc_headroom(SCCP_MSG_SIZE+SCCP_MSG_HEADROOM,
-				   SCCP_MSG_HEADROOM, name);
+	msg = msgb_alloc_headroom(SCCP_MSG_SIZE+SCCP_MSG_HEADROOM,
+				  SCCP_MSG_HEADROOM, name);
+	if (!msg)
+		return NULL;
+	msg->l2h = msg->tail;
+	return msg;
 }
 
 /***********************************************************************

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5fb11075593696b110bfd3e0541e3aa790029903
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list