lynxis lazus submitted this change.
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
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(-)
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 change 43696. To unsubscribe, or for help writing mail filters, visit settings.