Module: kamailio
Branch: master
Commit: 8a1613096ad86db125398e50d2ecced5d3ff1978
URL:
https://github.com/kamailio/kamailio/commit/8a1613096ad86db125398e50d2ecced…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-01-18T18:48:22+01:00
core: parser - check diversion pointer before accessing it
---
Modified: src/core/parser/parse_diversion.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8a1613096ad86db125398e50d2ecced…
Patch:
https://github.com/kamailio/kamailio/commit/8a1613096ad86db125398e50d2ecced…
---
diff --git a/src/core/parser/parse_diversion.c b/src/core/parser/parse_diversion.c
index 92690296935..557950052fa 100644
--- a/src/core/parser/parse_diversion.c
+++ b/src/core/parser/parse_diversion.c
@@ -210,17 +210,19 @@ int parse_diversion_header(struct sip_msg *msg)
int free_diversion_body(diversion_body_t *div_b)
{
- int i = 0;
+ int i;
+
+ if(div_b == NULL) {
+ return -1;
+ }
for(i = 0; i < div_b->num_ids; i++) {
/* Free to_body pointer parameters */
if(div_b->id[i].param_lst) {
free_to_params(&(div_b->id[i]));
}
}
+ pkg_free(div_b);
- if(div_b != NULL) {
- pkg_free(div_b);
- }
return 0;
}