Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [PATCH] http: fix memory leak
Date: Thu, 20 Dec 2018 18:47:34 +0300	[thread overview]
Message-ID: <ad4923f0934ff0db950b4717c00b8d1d05222c30.1545320731.git.alexander.turenko@tarantool.org> (raw)

The calloc() in parse_headers() leads to lost of 32 bytes on each
http_client request.

The problem was introduced in 1.9.1-38-g3d121dd4a.

Found with ASAN.
---

no issue
https://github.com/tarantool/tarantool/tree/Totktonada/fix-http-client-memleak

Please, push it to 2.1, 1.10 and 1.9.

 src/lua/httpc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lua/httpc.c b/src/lua/httpc.c
index 5f4e2e912..5572b70e9 100644
--- a/src/lua/httpc.c
+++ b/src/lua/httpc.c
@@ -112,6 +112,8 @@ parse_headers(lua_State *L, char *buffer, size_t len,
 		}
 	}
 
+	free(parser.hdr_name);
+
 	/* headers */
 	lua_settable(L, -3);
 
-- 
2.20.0

             reply	other threads:[~2018-12-20 15:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20 15:47 Alexander Turenko [this message]
2018-12-20 16:01 ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad4923f0934ff0db950b4717c00b8d1d05222c30.1545320731.git.alexander.turenko@tarantool.org \
    --to=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH] http: fix memory leak' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox