Module: kamailio
Branch: master
Commit: 2a0bef409ddd9d8e29963553bb3c4e2e77d36ffb
URL:
https://github.com/kamailio/kamailio/commit/2a0bef409ddd9d8e29963553bb3c4e2…
Author: Tsvetomir Dimitrov <tsv.dimitrov(a)gmail.com>
Committer: Tsvetomir Dimitrov <tsv.dimitrov(a)gmail.com>
Date: 2018-06-11T17:08:42+03:00
ims_registrar_pcscf: Updated security_t deallocation in sec_agree.c. Fix parsing of ealg
parameter.
---
Modified: src/modules/ims_registrar_pcscf/sec_agree.c
Modified: src/modules/ims_registrar_pcscf/sec_agree.h
---
Diff:
https://github.com/kamailio/kamailio/commit/2a0bef409ddd9d8e29963553bb3c4e2…
Patch:
https://github.com/kamailio/kamailio/commit/2a0bef409ddd9d8e29963553bb3c4e2…
---
diff --git a/src/modules/ims_registrar_pcscf/sec_agree.c
b/src/modules/ims_registrar_pcscf/sec_agree.c
index bc72272189..099dbbfff3 100644
--- a/src/modules/ims_registrar_pcscf/sec_agree.c
+++ b/src/modules/ims_registrar_pcscf/sec_agree.c
@@ -69,7 +69,7 @@ static int process_sec_agree_param(str name, str value, ipsec_t *ret)
SEC_COPY_STR_PARAM(ret->mod, value);
}
else if(strncasecmp(name.s, "ealg", name.len) == 0) {
- SEC_COPY_STR_PARAM(ret->r_alg, value);
+ SEC_COPY_STR_PARAM(ret->r_ealg, value);
}
else if(strncasecmp(name.s, "spi-c", name.len) == 0) {
ret->spi_uc = parse_digits(value);
@@ -201,20 +201,27 @@ static security_t* parse_sec_agree(struct hdr_field* h)
return params;
cleanup:
- if(params) {
+ // The same piece of code also lives in modules/ims_usrloc_pcscf/pcontact.c
+ // Function - free_security()
+ // Keep them in sync!
+ if (params) {
shm_free(params->sec_header.s);
- if(params->data.ipsec) {
+ if(params->type == SECURITY_IPSEC && params->data.ipsec) {
+ shm_free(params->data.ipsec->ealg.s);
+ shm_free(params->data.ipsec->r_ealg.s);
+ shm_free(params->data.ipsec->ck.s);
+ shm_free(params->data.ipsec->alg.s);
shm_free(params->data.ipsec->r_alg.s);
+ shm_free(params->data.ipsec->ik.s);
shm_free(params->data.ipsec->prot.s);
shm_free(params->data.ipsec->mod.s);
- shm_free(params->data.ipsec->ealg.s);
-
shm_free(params->data.ipsec);
}
shm_free(params);
}
+
return NULL;
}
diff --git a/src/modules/ims_registrar_pcscf/sec_agree.h
b/src/modules/ims_registrar_pcscf/sec_agree.h
index 421f30075b..958a79ca3b 100644
--- a/src/modules/ims_registrar_pcscf/sec_agree.h
+++ b/src/modules/ims_registrar_pcscf/sec_agree.h
@@ -32,6 +32,4 @@
*/
security_t* cscf_get_security(struct sip_msg *msg);
-void free_security_t(security_t *params);
-
#endif // SEC_AGREE_H