[MERGED] osmo-hlr[master]: add lu_op_free(), use in luop.c

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Oct 23 12:20:51 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: add lu_op_free(), use in luop.c
......................................................................


add lu_op_free(), use in luop.c

Add to luop.h, it will be used in db_hlr.c in an upcoming patch.

Change-Id: Ib44d9062edc957d2e0710b7e485604f97e4d5612
---
M src/luop.c
M src/luop.h
2 files changed, 12 insertions(+), 4 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/luop.c b/src/luop.c
index 1b17fe3..3bedbaa 100644
--- a/src/luop.c
+++ b/src/luop.c
@@ -114,6 +114,14 @@
 	return luop;
 }
 
+void lu_op_free(struct lu_operation *luop)
+{
+	/* Only attempt to remove when it was ever added to a list. */
+	if (luop->list.next)
+		llist_del(&luop->list);
+	talloc_free(luop);
+}
+
 struct lu_operation *lu_op_alloc_conn(struct osmo_gsup_conn *conn)
 {
 	uint8_t *peer_addr;
@@ -183,8 +191,7 @@
 
 	_luop_tx_gsup(luop, &gsup);
 
-	llist_del(&luop->list);
-	talloc_free(luop);
+	lu_op_free(luop);
 }
 
 /*! Transmit UPD_LOC_RESULT and destroy lu_operation */
@@ -197,8 +204,7 @@
 
 	_luop_tx_gsup(luop, &gsup);
 
-	llist_del(&luop->list);
-	talloc_free(luop);
+	lu_op_free(luop);
 }
 
 /*! Send Cancel Location to old VLR/SGSN */
diff --git a/src/luop.h b/src/luop.h
index ab1bc24..053a025 100644
--- a/src/luop.h
+++ b/src/luop.h
@@ -79,3 +79,5 @@
 void lu_op_tx_cancel_old(struct lu_operation *luop);
 void lu_op_tx_insert_subscr_data(struct lu_operation *luop);
 void lu_op_tx_del_subscr_data(struct lu_operation *luop);
+
+void lu_op_free(struct lu_operation *luop);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib44d9062edc957d2e0710b7e485604f97e4d5612
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list