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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-11-20T17:01:21+01:00

pv: reset buf.s to avoid double free on error for pv_set_xto_attr()

---

Modified: src/modules/pv/pv_core.c

---

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

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 1054a6ae57b..3eeba112324 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -3788,8 +3788,10 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
                        goto error;
                }
        } else {
-               if(buf.s != 0)
+               if(buf.s != 0) {
                        pkg_free(buf.s);
+                       buf.s = NULL;
+               }
        }
 
        if(llen_uri > 0) {
@@ -3805,8 +3807,9 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
                        goto error;
                }
        } else {
-               if(buf_uri.s != 0)
+               if(buf_uri.s != 0) {
                        pkg_free(buf_uri.s);
+               }
        }
 
        return 0;

_______________________________________________
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