[sr-dev] git:master:d37f5345: ims_usrloc_scscf: Fix ref-counting from previous commit...

Carsten Bock carsten at ng-voice.com
Sat Jul 4 19:19:11 CEST 2015


Module: kamailio
Branch: master
Commit: d37f534564f9f1e39ba5133bbac8098416192b6b
URL: https://github.com/kamailio/kamailio/commit/d37f534564f9f1e39ba5133bbac8098416192b6b

Author: Carsten Bock <carsten at ng-voice.com>
Committer: Carsten Bock <carsten at ng-voice.com>
Date: 2015-07-04T19:19:02+02:00

ims_usrloc_scscf: Fix ref-counting from previous commit...

---

Modified: modules/ims_usrloc_scscf/impurecord.c

---

Diff:  https://github.com/kamailio/kamailio/commit/d37f534564f9f1e39ba5133bbac8098416192b6b.diff
Patch: https://github.com/kamailio/kamailio/commit/d37f534564f9f1e39ba5133bbac8098416192b6b.patch

---

diff --git a/modules/ims_usrloc_scscf/impurecord.c b/modules/ims_usrloc_scscf/impurecord.c
index d996fca..a41eafd 100644
--- a/modules/ims_usrloc_scscf/impurecord.c
+++ b/modules/ims_usrloc_scscf/impurecord.c
@@ -846,8 +846,14 @@ int update_impurecord(struct udomain* _d, str* public_identity, impurecord_t* im
             unlock_subscription_slot(subs_ptr->sl);
         } else {
             //TODO: we may want to do a deep comparison of the subscription and update....
-            if (compare_subscription(subs_ptr, subscription) != 0)
+            if (compare_subscription(subs_ptr, subscription) != 0) {
                 subs_ptr = subscription;
+            } else {
+                // Treat it as a new Subscription - it's not the same as the previos one
+                ref_subscription_unsafe(subs_ptr); //we reference coz we are using it - will be unreferenced later.
+                add_subscription_unsafe(subs_ptr);
+                unlock_subscription_slot(subs_ptr->sl);
+            }            
         }
         lock_subscription(subs_ptr);
         subscription_locked = 1;




More information about the sr-dev mailing list