Module: kamailio
Branch: master
Commit: 36b1cfe97ff2736b693f3a0beff6b2052a942fdd
URL:
https://github.com/kamailio/kamailio/commit/36b1cfe97ff2736b693f3a0beff6b20…
Author: Carsten Bock <carsten(a)ng-voice.com>
Committer: Carsten Bock <carsten(a)ng-voice.com>
Date: 2015-05-05T21:59:39+02:00
ims_*_scscf: Safety checks for the locks
---
Modified: modules/ims_registrar_scscf/registrar_notify.c
Modified: modules/ims_registrar_scscf/userdata_parser.c
---
Diff:
https://github.com/kamailio/kamailio/commit/36b1cfe97ff2736b693f3a0beff6b20…
Patch:
https://github.com/kamailio/kamailio/commit/36b1cfe97ff2736b693f3a0beff6b20…
---
diff --git a/modules/ims_registrar_scscf/registrar_notify.c
b/modules/ims_registrar_scscf/registrar_notify.c
index e9b2ab1..a9a7216 100644
--- a/modules/ims_registrar_scscf/registrar_notify.c
+++ b/modules/ims_registrar_scscf/registrar_notify.c
@@ -122,7 +122,12 @@ int notify_init() {
LM_ERR("failed to create cdp event list lock\n");
return 0;
}
- notification_list->lock = lock_init(notification_list->lock);
+ if (lock_init(notification_list->lock)==0){
+ lock_dealloc(notification_list->lock);
+ notification_list->lock=0;
+ LM_ERR("failed to initialize cdp event list lock\n");
+ return 0;
+ }
notification_list->size = 0;
sem_new(notification_list->empty, 0); //pre-locked - as we assume list is empty at
start
return 1;
diff --git a/modules/ims_registrar_scscf/userdata_parser.c
b/modules/ims_registrar_scscf/userdata_parser.c
index 90e8976..8fc93b0 100644
--- a/modules/ims_registrar_scscf/userdata_parser.c
+++ b/modules/ims_registrar_scscf/userdata_parser.c
@@ -860,7 +860,18 @@ static ims_subscription* parse_ims_subscription(xmlDocPtr doc,
xmlNodePtr root)
s->service_profiles_cnt++;
}
s->lock = lock_alloc();
- s->lock = lock_init(s->lock);
+ if (s->lock==0) {
+ LM_ERR("Failed to allocate Lock for IMS Subscription\n");
+ shm_free(s);
+ return 0;
+ }
+ if (lock_init(s->lock)==0){
+ LM_ERR("Failed to initialize Lock for IMS Subscription\n");
+ lock_dealloc(s->lock);
+ s->lock=0;
+ shm_free(s);
+ return 0;
+ }
return s;
}