Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1 1/1] netbox: fix memleak in lbox_tuple_format_new()
@ 2019-10-30 10:58 imeevma
  2019-10-30 22:13 ` Vladislav Shpilevoy
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: imeevma @ 2019-10-30 10:58 UTC (permalink / raw)
  To: v.shpilevoy; +Cc: tarantool-patches, tarantool-patches

Memleak appeared due to the fact that when creating a dictionary
its reference count is 1 from the beginning. Later, when the
dictionary is used to create tuple_format, its reference counter
increased by 1 and it became equal to 2. After removing
tuple_format, the reference counter for dict decreased by one, so
it became equal to 1. Since ref counter is not equal to 0, dict
not deleted, causing a memory leak.

Closes #4588
---
 src/box/lua/misc.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/box/lua/misc.cc b/src/box/lua/misc.cc
index 7b8b9dc..102194e 100644
--- a/src/box/lua/misc.cc
+++ b/src/box/lua/misc.cc
@@ -233,6 +233,7 @@ lbox_tuple_format_new(struct lua_State *L)
 				 NULL, 0, 0, dict, false, false);
 	if (format == NULL)
 		return luaT_error(L);
+	tuple_dictionary_unref(dict);
 	return lbox_push_tuple_format(L, format);
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-05 10:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 10:58 [Tarantool-patches] [PATCH v1 1/1] netbox: fix memleak in lbox_tuple_format_new() imeevma
2019-10-30 22:13 ` Vladislav Shpilevoy
2019-10-31  9:33   ` [Tarantool-patches] [tarantool-patches] " Mergen Imeev
2019-10-31 15:23 ` [Tarantool-patches] " Konstantin Osipov
2019-10-31 16:43   ` Imeev Mergen
2019-11-02 16:26     ` Vladislav Shpilevoy
2019-11-05 10:38 ` [Tarantool-patches] [tarantool-patches] " Kirill Yukhin

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