From a767adef3a09af80ec2323d25265143b7e2d2100 Mon Sep 17 00:00:00 2001 From: Leif Walsh Date: Wed, 17 Apr 2013 00:01:28 -0400 Subject: [PATCH] refs #5889 fix memory leak git-svn-id: file:///svn/toku/tokudb@52556 c7de825b-a66e-492c-adef-691d508d4ae1 --- ft/ft.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ft/ft.cc b/ft/ft.cc index 9f35191958b..eeeb8107394 100644 --- a/ft/ft.cc +++ b/ft/ft.cc @@ -543,11 +543,16 @@ ft_handle_open_for_redirect(FT_HANDLE *new_ftp, const char *fname_in_env, TOKUTX toku_ft_handle_set_compression_method(t, old_h->h->compression_method); CACHETABLE ct = toku_cachefile_get_cachetable(old_h->cf); int r = toku_ft_handle_open_with_dict_id(t, fname_in_env, 0, 0, ct, txn, old_h->dict_id); - if (r == 0) { - assert(t->ft->dict_id.dictid == old_h->dict_id.dictid); - *new_ftp = t; + if (r != 0) { + goto cleanup; } + assert(t->ft->dict_id.dictid == old_h->dict_id.dictid); + *new_ftp = t; + cleanup: + if (r != 0) { + toku_ft_handle_close(t); + } return r; }