[sr-dev] git:master:82f7a6a7: ims_ipsec_pcscf: free memory on errors and variable supported

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 19 09:37:18 CEST 2018


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-10-19T09:36:00+02:00

ims_ipsec_pcscf: free memory on errors and variable supported

---

Modified: src/modules/ims_ipsec_pcscf/cmd.c

---

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

---

diff --git a/src/modules/ims_ipsec_pcscf/cmd.c b/src/modules/ims_ipsec_pcscf/cmd.c
index e0eeea8764..17e6c7b000 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -357,15 +357,19 @@ int add_supported_secagree_header(struct sip_msg* m)
 
     if((supported->s = pkg_malloc(supported_sec_agree_len)) == NULL) {
         LM_ERR("Error allcationg pkg memory for supported header str\n");
+        pkg_free(supported);
         return -1;
     }
     memcpy(supported->s, supported_sec_agree, supported_sec_agree_len);
     supported->len = supported_sec_agree_len;
 
     if(cscf_add_header(m, supported, HDR_SUPPORTED_T) != 1) {
+		pkg_free(supported->s);
+		pkg_free(supported);
         LM_ERR("Error adding security header to reply!\n");
         return -1;
     }
+    pkg_free(supported);
 
     return 0;
 }




More information about the sr-dev mailing list