From b3b83449cff7269937431e28fba3958a5d524671 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 30 Oct 2014 18:04:16 -0700 Subject: [PATCH] Clean up some memory allocation in builtin_commandline --- builtin_commandline.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/builtin_commandline.cpp b/builtin_commandline.cpp index 0bc60dca2..7f576aff7 100644 --- a/builtin_commandline.cpp +++ b/builtin_commandline.cpp @@ -480,16 +480,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv) const wchar_t *buffer = reader_get_buffer(); if (reader_get_selection(&start, &len)) { - wchar_t *selection = new wchar_t[len + 1]; - selection[len] = L'\0'; - selection = wcsncpy(selection, buffer + start, len); - - append_format(stdout_buffer, selection); - delete selection; - } - else - { - append_format(stdout_buffer, L""); + stdout_buffer.append(buffer + start, len); } return 0; }