From 9136ce8017660e92f624de6f7b8a07e50620dfa1 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 21 Jul 2017 13:51:36 +0200 Subject: [PATCH] xhttp: proper check for return of add lump rpl --- src/modules/xhttp/xhttp_mod.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/xhttp/xhttp_mod.c b/src/modules/xhttp/xhttp_mod.c index d41fc47f70b..8a542bfc8b1 100644 --- a/src/modules/xhttp/xhttp_mod.c +++ b/src/modules/xhttp/xhttp_mod.c @@ -382,11 +382,12 @@ static int xhttp_handler(sip_msg_t* msg) } else { DBG("new fake msg created (%d bytes):\n<%.*s>\n", fake_msg_len, fake_msg_len, fake_msg); - if (xhttp_process_request(msg, fake_msg, fake_msg_len)<0) + if (xhttp_process_request(msg, fake_msg, fake_msg_len)<0) { ret=NONSIP_MSG_ERROR; - pkg_free(fake_msg); } - return ret; + pkg_free(fake_msg); + } + return ret; } else { LM_DBG("http msg unchanged (%d bytes):\n<%.*s>\n", msg->len, msg->len, msg->buf); @@ -432,7 +433,7 @@ static int xhttp_send_reply(sip_msg_t *msg, int code, str *reason, if(body!=NULL && body->len>0) { - if (add_lump_rpl(msg, body->s, body->len, LUMP_RPL_BODY) < 0) + if (add_lump_rpl(msg, body->s, body->len, LUMP_RPL_BODY) == 0) { LM_ERR("Error while adding reply lump\n"); return -1;