Module: kamailio Branch: master Commit: be527b19062389d2621a1e01b1b17e4aa8e80f1a URL: https://github.com/kamailio/kamailio/commit/be527b19062389d2621a1e01b1b17e4a...
Author: jaybeepee jason.penton@gmail.com Committer: jaybeepee jason.penton@gmail.com Date: 2016-07-14T15:58:11+02:00
modules/ims_registrar_scscf: fix memory leak related to S-CSCF notification engine
---
Modified: modules/ims_registrar_scscf/registrar_notify.c
---
Diff: https://github.com/kamailio/kamailio/commit/be527b19062389d2621a1e01b1b17e4a... Patch: https://github.com/kamailio/kamailio/commit/be527b19062389d2621a1e01b1b17e4a...
---
diff --git a/modules/ims_registrar_scscf/registrar_notify.c b/modules/ims_registrar_scscf/registrar_notify.c index 9e41593..ff2db72 100644 --- a/modules/ims_registrar_scscf/registrar_notify.c +++ b/modules/ims_registrar_scscf/registrar_notify.c @@ -440,7 +440,7 @@ int can_subscribe_to_reg(struct sip_msg *msg, char *_t, char *str2) { int event_reg(udomain_t* _d, impurecord_t* r_passed, int event_type, str *presentity_uri, str *watcher_contact, str *explit_dereg_contact, int num_explit_dereg_contact) { impurecord_t* r; int num_impus; - str* impu_list; + str* impu_list = 0; int res = 0; udomain_t* udomain;
@@ -483,7 +483,10 @@ int event_reg(udomain_t* _d, impurecord_t* r_passed, int event_type, str *presen LM_DBG("About to ceate notification");
create_notifications(_d, r_passed, presentity_uri, watcher_contact, impu_list, num_impus, event_type, explit_dereg_contact, num_explit_dereg_contact); - return 0; + if (impu_list) { + pkg_free(impu_list); + } + return 0; break;
//richard: we only use reg unreg expired and refresh @@ -510,12 +513,18 @@ int event_reg(udomain_t* _d, impurecord_t* r_passed, int event_type, str *presen //TODO this should be a configurable module param if (ul.register_udomain(domain, &udomain) < 0) { LM_ERR("Unable to register usrloc domain....aborting\n"); - return 0; + if (impu_list) { + pkg_free(impu_list); + } + return 0; } LM_DBG("About to ceate notification");
create_notifications(_d, r_passed, presentity_uri, watcher_contact, impu_list, num_impus, event_type, explit_dereg_contact, num_explit_dereg_contact); - return 1; + if (impu_list) { + pkg_free(impu_list); + } + return 1;
default: LM_ERR("ERR:event_reg: Unknown event %d\n", event_type);