Module: kamailio Branch: master Commit: 453f45af78190dad79bdc4f787ba5a18ca7f6392 URL: https://github.com/kamailio/kamailio/commit/453f45af78190dad79bdc4f787ba5a18...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2017-08-08T09:52:09+02:00
xmlrpc: handle realloc failure
---
Modified: src/modules/xmlrpc/xmlrpc.c
---
Diff: https://github.com/kamailio/kamailio/commit/453f45af78190dad79bdc4f787ba5a18... Patch: https://github.com/kamailio/kamailio/commit/453f45af78190dad79bdc4f787ba5a18...
---
diff --git a/src/modules/xmlrpc/xmlrpc.c b/src/modules/xmlrpc/xmlrpc.c index 61b73d0993..bac1567ed6 100644 --- a/src/modules/xmlrpc/xmlrpc.c +++ b/src/modules/xmlrpc/xmlrpc.c @@ -1841,6 +1841,7 @@ static int rpc_struct_printf(struct rpc_struct* s, char* member_name, { int n, buf_size; char* buf; + char* buf0; va_list ap; str st, name; struct xmlrpc_reply* reply; @@ -1890,11 +1891,12 @@ static int rpc_struct_printf(struct rpc_struct* s, char* member_name, } else { /* glibc 2.0 */ buf_size *= 2; /* twice the old size */ } - if ((buf = mxr_realloc(buf, buf_size)) == 0) { + if ((buf0 = mxr_realloc(buf, buf_size)) == 0) { set_fault(reply, 500, "Internal Server Error (No memory left)"); ERR("No memory left\n"); goto err; } + buf = buf0; } return 0; err: