Browse code

xhttp: proper check for return of add lump rpl

Daniel-Constantin Mierla authored on 21/07/2017 11:51:36
Showing 1 changed files
... ...
@@ -382,11 +382,12 @@ static int xhttp_handler(sip_msg_t* msg)
382 382
 		} else {
383 383
 			DBG("new fake msg created (%d bytes):\n<%.*s>\n",
384 384
 					fake_msg_len, fake_msg_len, fake_msg);
385
-			if (xhttp_process_request(msg, fake_msg, fake_msg_len)<0)
385
+			if (xhttp_process_request(msg, fake_msg, fake_msg_len)<0) {
386 386
 				ret=NONSIP_MSG_ERROR;
387
-				pkg_free(fake_msg);
388 387
 			}
389
-			return ret;
388
+			pkg_free(fake_msg);
389
+		}
390
+		return ret;
390 391
 	} else {
391 392
 		LM_DBG("http msg unchanged (%d bytes):\n<%.*s>\n",
392 393
 				msg->len, msg->len, msg->buf);
... ...
@@ -432,7 +433,7 @@ static int xhttp_send_reply(sip_msg_t *msg, int code, str *reason,
432 433
 
433 434
 	if(body!=NULL && body->len>0)
434 435
 	{
435
-		if (add_lump_rpl(msg, body->s, body->len, LUMP_RPL_BODY) < 0)
436
+		if (add_lump_rpl(msg, body->s, body->len, LUMP_RPL_BODY) == 0)
436 437
 		{
437 438
 			LM_ERR("Error while adding reply lump\n");
438 439
 			return -1;