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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-04-12T17:24:11+02:00

lost: simplified lost_free_string()

- removed unnecessary memset() for lost_copy_string()

---

Modified: src/modules/lost/utilities.c

---

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

---

diff --git a/src/modules/lost/utilities.c b/src/modules/lost/utilities.c
index 307a0437d49..2e88a34742f 100644
--- a/src/modules/lost/utilities.c
+++ b/src/modules/lost/utilities.c
@@ -287,7 +287,6 @@ char *lost_copy_string(str src, int *lgth)
                if(res == NULL) {
                        PKG_MEM_ERROR;
                } else {
-                       memset(res, 0, src.len);
                        memcpy(res, src.s, src.len);
                        res[src.len] = '\0';
                        *lgth = (int)strlen(res);
@@ -303,21 +302,12 @@ char *lost_copy_string(str src, int *lgth)
  */
 void lost_free_string(str *string)
 {
-       str ptr = STR_NULL;
-
+       string->len = 0;
        if(string->s == NULL)
                return;
-
-       ptr = *string;
-
-       if(ptr.s != NULL) {
-               pkg_free(ptr.s);
-
-               LM_DBG("### string object removed\n");
-       }
-
+       pkg_free(string->s);
+       LM_DBG("### string object removed\n");
        string->s = NULL;
-       string->len = 0;
 
        return;
 }

_______________________________________________
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