Alex Henrie : conhost: Fix memory leak on error path in create_screen_buffer (cppcheck).
Alexandre Julliard
julliard at winehq.org
Wed Feb 2 16:38:03 CST 2022
Module: wine
Branch: master
Commit: 78df9cb96ccf7d5f2e7919a003209c0b6f6fe021
URL: https://source.winehq.org/git/wine.git/?a=commit;h=78df9cb96ccf7d5f2e7919a003209c0b6f6fe021
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Wed Feb 2 00:23:12 2022 -0700
conhost: Fix memory leak on error path in create_screen_buffer (cppcheck).
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/conhost/conhost.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index 78f6e345170..3c8d165cbbe 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -100,7 +100,11 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int
if (screen_buffer->font.face_len)
{
screen_buffer->font.face_name = malloc( screen_buffer->font.face_len * sizeof(WCHAR) );
- if (!screen_buffer->font.face_name) return NULL;
+ if (!screen_buffer->font.face_name)
+ {
+ free( screen_buffer );
+ return NULL;
+ }
memcpy( screen_buffer->font.face_name, console->active->font.face_name,
screen_buffer->font.face_len * sizeof(WCHAR) );
More information about the wine-cvs
mailing list