From e80f2fc8fa2fae8483d1579a3afe71bafed30279 Mon Sep 17 00:00:00 2001 From: Dan Pascu Date: Tue, 16 Oct 2018 13:02:11 +0300 Subject: [PATCH] Fixed illegal memory access after being freed --- net/proto_tcp/tcp_common.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/net/proto_tcp/tcp_common.h b/net/proto_tcp/tcp_common.h index cf70f874d23..0cad14bff68 100644 --- a/net/proto_tcp/tcp_common.h +++ b/net/proto_tcp/tcp_common.h @@ -425,15 +425,17 @@ static inline int tcp_handle_req(struct tcp_req *req, * unallocated memory - razvanc */ *req->parsed=c; memmove(req->buf, req->parsed, size); - } + #ifdef EXTRA_DEBUG - LM_DBG("preparing for new request, kept %ld bytes\n", size); + LM_DBG("preparing for new request, kept %ld bytes\n", size); #endif - init_tcp_req(req, size); - con->msg_attempts = 0; + init_tcp_req(req, size); - /* if we still have some unparsed bytes, try to parse them too*/ - if (size) return 1; + /* if we still have some unparsed bytes, try to parse them too */ + return 1; + } + + con->msg_attempts = 0; } else { /* request not complete - check the if the thresholds are exceeded */ if (con->msg_attempts==0)