Module: kamailio Branch: master Commit: 90b8e31c48d8489564bd9ad4d1430e1f02c5fecf URL: https://github.com/kamailio/kamailio/commit/90b8e31c48d8489564bd9ad4d1430e1f...
Author: Henning Westerholt hw@skalatan.de Committer: Henning Westerholt hw@skalatan.de Date: 2020-01-25T18:46:29+01:00
xhttp_rpc: add missing mem error log message, convert to memory logging helper
---
Modified: src/modules/xhttp_rpc/xhttp_rpc.c
---
Diff: https://github.com/kamailio/kamailio/commit/90b8e31c48d8489564bd9ad4d1430e1f... Patch: https://github.com/kamailio/kamailio/commit/90b8e31c48d8489564bd9ad4d1430e1f...
---
diff --git a/src/modules/xhttp_rpc/xhttp_rpc.c b/src/modules/xhttp_rpc/xhttp_rpc.c index 61cb5b1cd0..e51ff838bf 100644 --- a/src/modules/xhttp_rpc/xhttp_rpc.c +++ b/src/modules/xhttp_rpc/xhttp_rpc.c @@ -170,6 +170,7 @@ static struct rpc_data_struct *new_data_struct(rpc_ctx_t* ctx) if (!ctx) return NULL; ds = (struct rpc_data_struct*)pkg_malloc(sizeof(struct rpc_data_struct)); if (!ds) { + PKG_MEM_ERROR; rpc_fault(ctx, 500, "Internal Server Error (oom)"); return NULL; } @@ -196,7 +197,7 @@ static int init_xhttp_rpc_reply(rpc_ctx_t *ctx) reply->reason = XHTTP_RPC_REASON_OK; reply->buf.s = pkg_malloc(buf_size); if (!reply->buf.s) { - LM_ERR("oom\n"); + PKG_MEM_ERROR; rpc_fault(ctx, 500, "Internal Server Error (No memory left)"); return -1; } @@ -751,7 +752,7 @@ static int child_init(int rank) xhttp_rpc_mod_cmds = (xhttp_rpc_mod_cmds_t*)pkg_malloc(sizeof(xhttp_rpc_mod_cmds_t)); if (xhttp_rpc_mod_cmds==NULL){ - LM_ERR("oom\n"); + PKG_MEM_ERROR; return -1; } xhttp_rpc_mod_cmds->rpc_e_index = 0; @@ -853,7 +854,7 @@ static int ki_xhttp_rpc_dispatch(sip_msg_t* msg) /* Unescape args */ ctx.arg.s = pkg_malloc((arg.len+1)*sizeof(char)); if (ctx.arg.s==NULL){ - LM_ERR("oom\n"); + PKG_MEM_ERROR; rpc_fault(&ctx, 500, "Internal Server Error (oom)"); goto send_reply; }