From 54bc3265630a988be790e62de89426448c690c8b Mon Sep 17 00:00:00 2001 From: Dmitry Simonenko <pmwkaa@gmail.com> Date: Fri, 5 Jul 2013 16:24:42 +0400 Subject: [PATCH] tarantool-snap: fix memory leak and snapshot tuple path --- client/tarantool_snap/cursor.c | 4 ++-- client/tarantool_snap/indexate.c | 5 +++-- client/tarantool_snap/snapshot.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/tarantool_snap/cursor.c b/client/tarantool_snap/cursor.c index 8eea38a21c..fd1e3e95ea 100644 --- a/client/tarantool_snap/cursor.c +++ b/client/tarantool_snap/cursor.c @@ -62,7 +62,7 @@ ts_cursor_tuple(struct ts_cursor *c) struct tnt_tuple *t = NULL; if (c->r->is_snap) { - t = &c->current.current.value->t; + t = &c->current.current_value.t; } else { struct tnt_request *rp = &c->current.current_value.r; switch (rp->h.type) { @@ -89,7 +89,7 @@ ts_cursor_close(struct ts_cursor *c) if (c->r == NULL) return; if (c->r->is_snap) { - tnt_tuple_free(&c->current.current.value->t); + tnt_tuple_free(&c->current.current_value.t); } else { tnt_request_free(&c->current.current_value.r); } diff --git a/client/tarantool_snap/indexate.c b/client/tarantool_snap/indexate.c index 86a71967d3..1041604823 100644 --- a/client/tarantool_snap/indexate.c +++ b/client/tarantool_snap/indexate.c @@ -257,11 +257,12 @@ xlog_process_row(struct ts_spaces *s, int fileid, int offset, struct tnt_request /* free old key */ struct tnt_tuple *n = ts_update(r, old); - if (n == NULL) + if (n == NULL) { return -1; + } /* free old tuple */ - /*tnt_tuple_free(old);*/ + tnt_tuple_free(old); /* close file */ ts_cursor_close(&cursor); diff --git a/client/tarantool_snap/snapshot.c b/client/tarantool_snap/snapshot.c index 63c0dad570..bd260ceb80 100644 --- a/client/tarantool_snap/snapshot.c +++ b/client/tarantool_snap/snapshot.c @@ -98,7 +98,7 @@ ts_snapshot_xfer(FILE *snapshot, struct tnt_log *current, struct tnt_tuple *t = NULL; if (r->is_snap) { - t = ¤t->current.value->t; + t = ¤t->current_value.t; } else { struct tnt_request *rp = ¤t->current_value.r; switch (rp->h.type) { -- GitLab