diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-10-17 01:46:04 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2017-10-17 02:01:08 +0200 |
commit | 200f56e995563c4af6fcd083b9dd4cab15632440 (patch) | |
tree | 441dd51c9f01458e70fbc7787476656e54045fb0 | |
parent | 50e4de7e499681e5e8a844951a1979e34546101c (diff) |
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
-rw-r--r-- | src/luop.c | 14 | ||||
-rw-r--r-- | src/luop.h | 2 |
2 files changed, 12 insertions, 4 deletions
@@ -114,6 +114,14 @@ struct lu_operation *lu_op_alloc(struct osmo_gsup_server *srv) 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 @@ void lu_op_tx_error(struct lu_operation *luop, enum gsm48_gmm_cause cause) _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 @@ void lu_op_tx_ack(struct lu_operation *luop) _luop_tx_gsup(luop, &gsup); - llist_del(&luop->list); - talloc_free(luop); + lu_op_free(luop); } /*! Send Cancel Location to old VLR/SGSN */ @@ -79,3 +79,5 @@ void lu_op_tx_ack(struct lu_operation *luop); 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); |