aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-05-31 16:42:05 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-05-31 16:42:07 +0200
commit93dd798a998824b50b5d65b822ac3db9ad7eafc2 (patch)
tree3f6ce9444bcaeae5ce160f2958de5e9439393f8c
parent8651573632aae264aef9e6d7fa5c25571f0b7149 (diff)
gtp: Re-arrange free pdp ctx code in non-teardown scenario
Code modified actually behaves the same, since gtp_freepdp() also calls delete cb, and this way it's more consistent with rest of the code base. Change-Id: I299765816e9d885497110d2e834f7ccdc943052c
-rw-r--r--gtp/gtp.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 5dde6b5..9ae208a 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -2421,13 +2421,14 @@ int gtp_delete_context_req(struct gsn_t *gsn, struct pdp_t *pdp, void *cbp,
because we don't want user to release its related
data and not use it anymore.
*/
- if (gsn->cb_delete_context)
- gsn->cb_delete_context(pdp);
if (pdp == linked_pdp) {
- linked_pdp->secondary_tei[pdp->nsapi & 0xf0] = 0;
- linked_pdp->nodata = 1;
- } else
- pdp_freepdp(pdp);
+ if (gsn->cb_delete_context)
+ gsn->cb_delete_context(pdp);
+ pdp->secondary_tei[pdp->nsapi & 0xf0] = 0;
+ pdp->nodata = 1;
+ } else {
+ gtp_freepdp(gsn, pdp);
+ }
}
return 0;
@@ -2510,14 +2511,14 @@ int gtp_delete_pdp_resp(struct gsn_t *gsn, int version,
because we don't want user to release its related
data and not use it anymore.
*/
- if (gsn->cb_delete_context)
- gsn->cb_delete_context(pdp);
if (pdp == linked_pdp) {
- linked_pdp->secondary_tei[pdp->nsapi & 0xf0] =
- 0;
- linked_pdp->nodata = 1;
- } else
- pdp_freepdp(pdp);
+ if (gsn->cb_delete_context)
+ gsn->cb_delete_context(pdp);
+ pdp->secondary_tei[pdp->nsapi & 0xf0] = 0;
+ pdp->nodata = 1;
+ } else {
+ gtp_freepdp(gsn, pdp);
+ }
}
}
/* if (cause == GTPCAUSE_ACC_REQ) */