From 5d18d60e3b9f9f4d6e12f14e8c68b147429b9fb3 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 29 Feb 2012 18:09:20 -0800 Subject: [PATCH] Squash some leaks --- complete.cpp | 6 ++++-- path.cpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/complete.cpp b/complete.cpp index 0314a4ab1..ca37ec2a1 100644 --- a/complete.cpp +++ b/complete.cpp @@ -977,7 +977,6 @@ void completer_t::complete_cmd( const wcstring &str, bool use_function, bool use wchar_t *nxt_path; wchar_t *state; std::vector possible_comp; - wchar_t *nxt_completion; wchar_t *cdpath_cpy = wcsdup(L"."); @@ -1020,7 +1019,7 @@ void completer_t::complete_cmd( const wcstring &str, bool use_function, bool use } add_slash = nxt_path[path_len-1]!=L'/'; - nxt_completion = wcsdupcat( nxt_path, + wchar_t *nxt_completion = wcsdupcat( nxt_path, add_slash?L"/":L"", cmd ); if( ! nxt_completion ) @@ -1042,6 +1041,8 @@ void completer_t::complete_cmd( const wcstring &str, bool use_function, bool use } } } + + free(nxt_completion); } free( path_cpy ); if (wants_description) @@ -1100,6 +1101,7 @@ void completer_t::complete_cmd( const wcstring &str, bool use_function, bool use ACCEPT_INCOMPLETE | DIRECTORIES_ONLY ) != EXPAND_ERROR ) { } + free(nxt_completion); } } } diff --git a/path.cpp b/path.cpp index 50b35795b..a7cd91ecb 100644 --- a/path.cpp +++ b/path.cpp @@ -242,6 +242,7 @@ wchar_t *path_get_path( const wchar_t *cmd ) } } } + free( new_cmd ); free( path_cpy ); }