Module: kamailio
Branch: master
Commit: 72443722d7fda4289390ef8bc20ad91990b895a7
URL:
https://github.com/kamailio/kamailio/commit/72443722d7fda4289390ef8bc20ad91…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-04-25T12:04:06+02:00
rls: free resources in case of errors
---
Modified: src/modules/rls/resource_notify.c
---
Diff:
https://github.com/kamailio/kamailio/commit/72443722d7fda4289390ef8bc20ad91…
Patch:
https://github.com/kamailio/kamailio/commit/72443722d7fda4289390ef8bc20ad91…
---
diff --git a/src/modules/rls/resource_notify.c b/src/modules/rls/resource_notify.c
index 0f31e7c877..d3ad4fd1fc 100644
--- a/src/modules/rls/resource_notify.c
+++ b/src/modules/rls/resource_notify.c
@@ -146,6 +146,9 @@ int send_notify(xmlDocPtr * rlmi_doc, char * buf, int buf_len,
int result = 0;
str rlmi_cont= {0, 0}, multi_cont;
+ if(rlmi_doc==NULL || *rlmi_doc==NULL) {
+ return -1;
+ }
xmlDocDumpFormatMemory(*rlmi_doc,(xmlChar**)(void*)&rlmi_cont.s,
&rlmi_cont.len, 0);
@@ -183,7 +186,6 @@ static void send_notifies(db1_res_t *result, int did_col, int
resource_uri_col,
subs_t* dialog= NULL;
int len_est = 0;
int resource_added = 0; /* Flag to indicate that we have added at least one resource */
- int ok = 0;
/* generate the boundary string */
boundary_string= generate_string(BOUNDARY_STRING_LEN);
@@ -431,7 +433,6 @@ static void send_notifies(db1_res_t *result, int did_col, int
resource_uri_col,
}
done:
- ok = 1;
if (dbmode == RLS_DB_ONLY && rls_dbf.end_transaction)
{
if (rls_dbf.end_transaction(rls_db) < 0)
@@ -456,11 +457,10 @@ static void send_notifies(db1_res_t *result, int did_col, int
resource_uri_col,
LM_ERR("in abort_transaction\n");
}
- if(ok==0) {
- if(rlmi_doc!=NULL) {
- xmlFreeDoc(rlmi_doc);
- }
+ if(rlmi_doc!=NULL) {
+ xmlFreeDoc(rlmi_doc);
}
+
return;
}