From 79e0405f6a6e56c2430d5d74b6c150d0b5d0e2fe Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 30 Jan 2012 02:23:58 -0800 Subject: Yet more un-hallocing --- highlight.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'highlight.cpp') diff --git a/highlight.cpp b/highlight.cpp index f0fbacea..8f7cbf88 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -605,11 +605,10 @@ void tokenize( const wchar_t * const buff, int * const color, const int pos, arr if( cmd && (wcscmp( cmd, L"cd" ) == 0) ) { - wchar_t *dir = expand_one( context, - wcsdup(tok_last( &tok )), - EXPAND_SKIP_CMDSUBST ); - if( dir ) + wcstring dir_str = tok_last( &tok ); + if (expand_one(dir_str, EXPAND_SKIP_CMDSUBST)) { + const wchar_t *dir = dir_str.c_str(); int is_long_help = wcsncmp(dir,L"--help", wcslen(dir) ); int is_short_help = wcsncmp(dir,L"-h", wcslen(dir) ); -- cgit v1.2.3