aboutsummaryrefslogtreecommitdiffhomepage
path: root/expand.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 17:06:47 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 17:06:47 -0800
commit207ab2aa5bff997a32971f4e5c4d79ebfd644764 (patch)
tree4f4b3197974999d8e7006afc0d96e2822d28e1ea /expand.cpp
parent4ccc2550d0da858a0ebcbce75f3d63723a401e69 (diff)
Squashed all known remaining leaks!
Diffstat (limited to 'expand.cpp')
-rw-r--r--expand.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/expand.cpp b/expand.cpp
index 596fceeb..0f59c56f 100644
--- a/expand.cpp
+++ b/expand.cpp
@@ -1429,16 +1429,16 @@ static int expand_variables_internal( parser_t &parser, wchar_t * const in, std:
/**
Perform bracket expansion
*/
-static int expand_brackets(parser_t &parser, wchar_t *in, int flags, std::vector<completion_t> &out )
+static int expand_brackets(parser_t &parser, const wchar_t *in, int flags, std::vector<completion_t> &out )
{
- wchar_t *pos;
+ const wchar_t *pos;
int syntax_error=0;
int bracket_count=0;
- wchar_t *bracket_begin=0, *bracket_end=0;
- wchar_t *last_sep=0;
+ const wchar_t *bracket_begin=0, *bracket_end=0;
+ const wchar_t *last_sep=0;
- wchar_t *item_begin;
+ const wchar_t *item_begin;
int len1, len2, tot_len;
CHECK( in, 0 );
@@ -1559,7 +1559,6 @@ static int expand_brackets(parser_t &parser, wchar_t *in, int flags, std::vector
bracket_count--;
}
}
- free(in);
return 1;
}
@@ -2090,7 +2089,7 @@ int expand_string2( const wcstring &input, std::vector<completion_t> &output, in
{
wcstring next = in->at(i).completion;
- if( !expand_brackets( parser, wcsdup(next.c_str()), flags, *out ))
+ if( !expand_brackets( parser, next.c_str(), flags, *out ))
{
return EXPAND_ERROR;
}