[sr-dev] git:master:9136ce80: xhttp: proper check for return of add lump rpl

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 21 13:52:22 CEST 2017


Module: kamailio
Branch: master
Commit: 9136ce8017660e92f624de6f7b8a07e50620dfa1
URL: https://github.com/kamailio/kamailio/commit/9136ce8017660e92f624de6f7b8a07e50620dfa1

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-21T13:51:36+02:00

xhttp: proper check for return of add lump rpl

---

Modified: src/modules/xhttp/xhttp_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/9136ce8017660e92f624de6f7b8a07e50620dfa1.diff
Patch: https://github.com/kamailio/kamailio/commit/9136ce8017660e92f624de6f7b8a07e50620dfa1.patch

---

diff --git a/src/modules/xhttp/xhttp_mod.c b/src/modules/xhttp/xhttp_mod.c
index d41fc47f70..8a542bfc8b 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;




More information about the sr-dev mailing list