[tarantool-patches] [PATCH 1/1] vinyl: fix memory leak on error in vy_history_apply

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri May 4 21:07:51 MSK 2018


---
Branch: https://github.com/tarantool/tarantool/tree/vy-fix-memleak

 src/box/vy_history.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/box/vy_history.c b/src/box/vy_history.c
index c1fe6c6af..7687e2d9f 100644
--- a/src/box/vy_history.c
+++ b/src/box/vy_history.c
@@ -100,10 +100,10 @@ vy_history_apply(struct vy_history *history, const struct key_def *cmp_def,
 		struct tuple *stmt = vy_apply_upsert(node->stmt, curr_stmt,
 						     cmp_def, format, true);
 		++*upserts_applied;
-		if (stmt == NULL)
-			return -1;
 		if (curr_stmt != NULL)
 			tuple_unref(curr_stmt);
+		if (stmt == NULL)
+			return -1;
 		curr_stmt = stmt;
 		node = rlist_prev_entry_safe(node, &history->stmts, link);
 	}
-- 
2.15.1 (Apple Git-101)





More information about the Tarantool-patches mailing list