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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-04-12T16:43:30+02:00

lost: condition only on str pointer to free it

- cover empty strings

---

Modified: src/modules/lost/response.c
Modified: src/modules/lost/utilities.c

---

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

---

diff --git a/src/modules/lost/response.c b/src/modules/lost/response.c
index 7ff63ca98a3..64cd55170aa 100644
--- a/src/modules/lost/response.c
+++ b/src/modules/lost/response.c
@@ -839,10 +839,9 @@ p_lost_info_t lost_get_response_info(
                } else {
                        tmp.s = lost_get_content(node, name, &tmp.len);
                }
-               if(tmp.len > 0 && tmp.s != NULL) {
+               if(tmp.s != NULL) {
                        res->text = lost_copy_string(tmp, &len);
-                       if(len > 0) {
-
+                       if(res->text != NULL) {
                                LM_DBG("###\t\t[%s]\n", res->text);
                        }
                        lost_free_string(&tmp); /* clean up */
diff --git a/src/modules/lost/utilities.c b/src/modules/lost/utilities.c
index 802fb597e84..307a0437d49 100644
--- a/src/modules/lost/utilities.c
+++ b/src/modules/lost/utilities.c
@@ -310,7 +310,7 @@ void lost_free_string(str *string)
 
        ptr = *string;
 
-       if(ptr.s != NULL && ptr.len > 0) {
+       if(ptr.s != NULL) {
                pkg_free(ptr.s);
 
                LM_DBG("### string object removed\n");

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to