Robert Shearman : server: Free ptr in console_input_append_hist.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 7 08:05:37 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 7a3df4d097a2f9f2f2362196cc174b436a7cab0d
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=7a3df4d097a2f9f2f2362196cc174b436a7cab0d

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri Apr  7 11:17:12 2006 +0100

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 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/server/console.c b/server/console.c
index 57a5804..120633d 100644
--- a/server/console.c
+++ b/server/console.c
@@ -897,13 +897,12 @@ static void console_input_append_hist( s
     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;
     }
 




More information about the wine-cvs mailing list