Module: kamailio
Branch: master
Commit: 2264b5ca85256db2c3701575a24865f45b657c6c
URL:
https://github.com/kamailio/kamailio/commit/2264b5ca85256db2c3701575a24865f…
Author: Pantelis Kolatsis <pk(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2023-04-25T11:49:47Z
call_control: convert to memory logging helper, add cleanup for errors
---
Modified: src/modules/call_control/call_control.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2264b5ca85256db2c3701575a24865f…
Patch:
https://github.com/kamailio/kamailio/commit/2264b5ca85256db2c3701575a24865f…
---
diff --git a/src/modules/call_control/call_control.c
b/src/modules/call_control/call_control.c
index 14455ec967f..f9d152f85f2 100644
--- a/src/modules/call_control/call_control.c
+++ b/src/modules/call_control/call_control.c
@@ -260,6 +260,10 @@ cc_parse_param(void *val, AVP_List** avps) {
}
p0 = (char*) pkg_malloc (content.len + 1);
+ if(!(p0)) {
+ PKG_MEM_ERROR;
+ return -1;
+ }
CHECK_ALLOC(p0);
memset(p0, 0, content.len + 1);
p = p0;
@@ -270,10 +274,22 @@ cc_parse_param(void *val, AVP_List** avps) {
for (;*p != '\0';) {
mp = (AVP_List*) pkg_malloc (sizeof(AVP_List));
+ if(!(mp)) {
+ PKG_MEM_ERROR;
+ pkg_free(p0);
+ return -1;
+ }
CHECK_ALLOC(mp);
memset(mp, 0, sizeof(AVP_List));
mp->next = *avps;
mp->pv = (pv_spec_p) pkg_malloc (sizeof(pv_spec_t));
+ if(!(mp->next))
+ {
+ PKG_MEM_ERROR;
+ pkg_free(p0);
+ pkg_free(mp);
+ return -1;
+ }
CHECK_ALLOC(mp->pv);
memset(mp->pv, 0, sizeof(pv_spec_t));