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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-03-04T09:07:22+01:00

acc: cdr - do not free static empty string in case of error

---

Modified: src/modules/acc/acc_cdr.c

---

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

---

diff --git a/src/modules/acc/acc_cdr.c b/src/modules/acc/acc_cdr.c
index 4ec019f1f8d..4c003e0ecab 100644
--- a/src/modules/acc/acc_cdr.c
+++ b/src/modules/acc/acc_cdr.c
@@ -113,10 +113,10 @@ int cdr_core2strar(struct dlg_cell *dlg, str *values, int 
*unused, char *types)
                                /* cleanup already allocated memory and
                                 * return that we didn't do anything */
                                for(i = i - 1; i >= 0; i--) {
-                                       if(NULL != values[i].s) {
+                                       if(NULL != values[i].s && types[i] != 
TYPE_NULL) {
                                                pkg_free(values[i].s);
-                                               values[i].s = NULL;
                                        }
+                                       values[i].s = NULL;
                                }
                                return 0;
                        }

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to