lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/43696?usp=email ) ( 3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: mmctx: don't leak a vlr vsub reference ...................................................................... mmctx: don't leak a vlr vsub reference When assigning a vsub to a mmctx, ensure it is not already assigned and if so, release the old one. Change-Id: Ia3ee3997541640d33f761851b805251d4a77f2f1 --- M src/sgsn/gprs_gmm.c M src/sgsn/mmctx.c 2 files changed, 12 insertions(+), 0 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c index ffae731..312c622 100644 --- a/src/sgsn/gprs_gmm.c +++ b/src/sgsn/gprs_gmm.c @@ -2351,6 +2351,14 @@ if (!mmctx) return -EINVAL; + if (mmctx->vsub) { + if (vsub == mmctx->vsub) + return 0; + + /* free the old vsub */ + vlr_subscr_put(mmctx->vsub, "mmctx"); + } + vlr_subscr_get(vsub, "mmctx"); mmctx->vsub = vsub; if (!strlen(mmctx->imsi) && strlen(mmctx->vsub->imsi)) diff --git a/src/sgsn/mmctx.c b/src/sgsn/mmctx.c index 66d9198..c3ab1b4 100644 --- a/src/sgsn/mmctx.c +++ b/src/sgsn/mmctx.c @@ -650,6 +650,10 @@ { bool created = false; + /* No need to bind it a second time */ + if (mm->vsub) + return 0; + if (imsi) mm->vsub = vlr_subscr_find_or_create_by_imsi(sgsn->vlr, imsi, "mmctx", &created); else -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/43696?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ia3ee3997541640d33f761851b805251d4a77f2f1 Gerrit-Change-Number: 43696 Gerrit-PatchSet: 7 Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> Gerrit-Reviewer: pespin <pespin@sysmocom.de>