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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2024-07-18T12:00:47+02:00

core: init res inside select_cfg_var()

---

Modified: src/core/cfg/cfg_select.c

---

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

---

diff --git a/src/core/cfg/cfg_select.c b/src/core/cfg/cfg_select.c
index f948dd4ab4c..f3b2d681d3e 100644
--- a/src/core/cfg/cfg_select.c
+++ b/src/core/cfg/cfg_select.c
@@ -147,6 +147,9 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg 
*msg)
        int i;
        static char buf[INT2STR_MAX_LEN];
 
+       res->s = 0;
+       res->len = 0;
+
        if(msg == NULL) {
                /* fixup call */
 
@@ -228,12 +231,7 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg 
*msg)
                        break;
 
                case CFG_VAR_STR:
-                       if(p) {
-                               memcpy(res, p, sizeof(str));
-                       } else {
-                               res->s = 0;
-                               res->len = 0;
-                       }
+                       memcpy(res, p, sizeof(str));
                        break;
 
                default:

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to