From 7a3df4d097a2f9f2f2362196cc174b436a7cab0d Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Fri, 7 Apr 2006 11:17:12 +0100 Subject: [PATCH] server: Free ptr in console_input_append_hist. Free ptr in console_input_append_hist before returning, otherwise it will be leaked (found by Coverity). Remove the setting of last error on mem_alloc failure, as it is already done in mem_alloc. --- server/console.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/console.c b/server/console.c index 57a5804d8b9..120633d7fca 100644 --- a/server/console.c +++ b/server/console.c @@ -897,13 +897,12 @@ static void console_input_append_hist( struct console_input* console, const WCHA WCHAR* ptr = mem_alloc( (len + 1) * sizeof(WCHAR) ); if (!ptr) - { - set_error( STATUS_NO_MEMORY ); - return; - } + return; + if (!console || !console->history_size) { set_error( STATUS_INVALID_PARAMETER ); /* FIXME */ + free( ptr ); return; }