Module: kamailio
Branch: 6.0
Commit: 61bac4f25140b5af61e37b7fe13dd4a0c229732b
URL: 
https://github.com/kamailio/kamailio/commit/61bac4f25140b5af61e37b7fe13dd4a0c229732b

Author: Victor Seva <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2026-05-04T11:12:17+02:00

ims_registrar_pcscf: Fix problems with double mem free, take two

* include sec_header check
* don't free data.ipsec before

related #4671

(cherry picked from commit 824dc0d39bf067ba343d7503b218e131a1944eea)
(cherry picked from commit 72e19957e2097b5a96ef50437dde9fae75077a63)

---

Modified: src/modules/ims_registrar_pcscf/sec_agree.c

---

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

---

diff --git a/src/modules/ims_registrar_pcscf/sec_agree.c 
b/src/modules/ims_registrar_pcscf/sec_agree.c
index 3b24467f911..2cd0567329b 100644
--- a/src/modules/ims_registrar_pcscf/sec_agree.c
+++ b/src/modules/ims_registrar_pcscf/sec_agree.c
@@ -214,8 +214,8 @@ static security_t *parse_sec_agree(struct hdr_field *h)
        // Function - free_security()
        // Keep them in sync!
        if(params) {
-               shm_free(params->sec_header.s);
-               shm_free(params->data.ipsec);
+               if(params->sec_header.s)
+                       shm_free(params->sec_header.s);
                if(params->type == SECURITY_IPSEC && params->data.ipsec) {
                        if(params->data.ipsec->ealg.s)
                                shm_free(params->data.ipsec->ealg.s);

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to