[sr-dev] git:master:4ebc2dc5: xmlrpc: improve error log messages, add memory helper at a few places
Henning Westerholt
hw at skalatan.de
Sat Jan 25 19:21:12 CET 2020
Module: kamailio
Branch: master
Commit: 4ebc2dc56c43b6b94ac1847762ee44713440ced0
URL: https://github.com/kamailio/kamailio/commit/4ebc2dc56c43b6b94ac1847762ee44713440ced0
Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-01-25T18:39:25+01:00
xmlrpc: improve error log messages, add memory helper at a few places
---
Modified: src/modules/xmlrpc/http.c
Modified: src/modules/xmlrpc/xmlrpc.c
---
Diff: https://github.com/kamailio/kamailio/commit/4ebc2dc56c43b6b94ac1847762ee44713440ced0.diff
Patch: https://github.com/kamailio/kamailio/commit/4ebc2dc56c43b6b94ac1847762ee44713440ced0.patch
---
diff --git a/src/modules/xmlrpc/http.c b/src/modules/xmlrpc/http.c
index 81fb6df9b7..6cdc12571f 100644
--- a/src/modules/xmlrpc/http.c
+++ b/src/modules/xmlrpc/http.c
@@ -64,14 +64,14 @@ static int insert_fake_via(sip_msg_t* msg, char* via, int via_len)
via_cnt++;
vb = pkg_malloc(sizeof(struct via_body));
if (vb == 0){
- LM_ERR("out of pkg memory\n");
+ PKG_MEM_ERROR;
goto error;
}
memset(vb, 0, sizeof(struct via_body));
msg->h_via1 = pkg_malloc(sizeof(hdr_field_t));
if (!msg->h_via1) {
- ERR("No memory left\n");
+ PKG_MEM_ERROR;
goto error;
}
memset(msg->h_via1, 0, sizeof(hdr_field_t));
diff --git a/src/modules/xmlrpc/xmlrpc.c b/src/modules/xmlrpc/xmlrpc.c
index 7552b4d7f1..dd64cf06f9 100644
--- a/src/modules/xmlrpc/xmlrpc.c
+++ b/src/modules/xmlrpc/xmlrpc.c
@@ -2039,13 +2039,17 @@ static struct rpc_delayed_ctx* rpc_delayed_ctx_new(rpc_ctx_t* ctx)
return 0; /* no delayed reply if already replied */
/* clone the sip msg */
shm_msg=sip_msg_shm_clone(ctx->msg, &len, 1);
- if (shm_msg==0)
+ if (shm_msg==0) {
+ ERR("could not clone SIP message in shared memory\n");
goto error;
+ }
/* alloc into one block */
size=ROUND_POINTER(sizeof(*ret))+sizeof(rpc_ctx_t);
- if ((ret=shm_malloc(size))==0)
+ if ((ret=shm_malloc(size))==0) {
+ SHM_MEM_ERROR;
goto error;
+ }
memset(ret, 0, size);
ret->rpc=func_param;
ret->reply_ctx=(char*)ret+ROUND_POINTER(sizeof(*ret));
@@ -2508,7 +2512,7 @@ static int ki_xmlrpc_reply(sip_msg_t* msg, int rcode, str* reason)
reply.reason = as_asciiz(reason);
if (reply.reason == NULL) {
- ERR("No memory left\n");
+ ERR("could not convert string\n");
goto error;
}
More information about the sr-dev
mailing list