-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path222436.mypatch
31 lines (26 loc) · 1.16 KB
/
222436.mypatch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From: Alex Henrie <[email protected]>
Subject: [PATCH] conhost: Fix memory leak on error path in create_screen_buffer (cppcheck)
Message-Id: <[email protected]>
Date: Mon, 20 Dec 2021 22:01:36 -0700
Signed-off-by: Alex Henrie <[email protected]>
---
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) );
--
2.34.1