* [PATCH] vinyl: fix tuple leak in vy_tuple_new
@ 2018-12-21 15:40 Vladimir Davydov
2018-12-21 15:48 ` Vladimir Davydov
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Davydov @ 2018-12-21 15:40 UTC (permalink / raw)
To: tarantool-patches
tuple_format_vtab::tuple_new() callback is supposed to return a tuple
with 0 references, but vinyl implementation returns a tuple with the
reference counter set to 1, effectively leaking the new tuple.
How to reproduce: get a tuple from a vinyl space and update it with
box.tuple.update().
The bug was introduced by commit a377332a7314 ("tuple: fix lost format
on update and upsert operations").
---
src/box/vy_stmt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/box/vy_stmt.c b/src/box/vy_stmt.c
index 3e60fece..cd1ad505 100644
--- a/src/box/vy_stmt.c
+++ b/src/box/vy_stmt.c
@@ -86,7 +86,12 @@ vy_tuple_new(struct tuple_format *format, const char *data, const char *end)
if (tuple_validate_raw(format, data) != 0)
return NULL;
- return vy_stmt_new_insert(format, data, end);
+ struct tuple *tuple = vy_stmt_new_insert(format, data, end);
+ if (tuple != NULL) {
+ tuple_bless(tuple);
+ tuple_unref(tuple);
+ }
+ return tuple;
}
struct tuple_format_vtab vy_tuple_format_vtab = {
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] vinyl: fix tuple leak in vy_tuple_new
2018-12-21 15:40 [PATCH] vinyl: fix tuple leak in vy_tuple_new Vladimir Davydov
@ 2018-12-21 15:48 ` Vladimir Davydov
0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2018-12-21 15:48 UTC (permalink / raw)
To: tarantool-patches
Pushed to 2.1 and 1.10.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-21 15:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-21 15:40 [PATCH] vinyl: fix tuple leak in vy_tuple_new Vladimir Davydov
2018-12-21 15:48 ` Vladimir Davydov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox