Sebastian Lackner : server: Avoid leaking file descriptors if create_console_input fails.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Nov 18 10:25:18 CST 2014
Module: wine
Branch: master
Commit: 609d43e4086188838e0900477db5651709ef36be
URL: http://source.winehq.org/git/wine.git/?a=commit;h=609d43e4086188838e0900477db5651709ef36be
Author: Sebastian Lackner <sebastian at fds-team.de>
Date: Mon Nov 17 19:15:20 2014 +0100
server: Avoid leaking file descriptors if create_console_input fails.
---
server/console.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/server/console.c b/server/console.c
index 2a5ca80..b7f8206 100644
--- a/server/console.c
+++ b/server/console.c
@@ -299,7 +299,11 @@ static struct object *create_console_input( struct thread* renderer, int fd )
{
struct console_input *console_input;
- if (!(console_input = alloc_object( &console_input_ops ))) return NULL;
+ if (!(console_input = alloc_object( &console_input_ops )))
+ {
+ if (fd != -1) close( fd );
+ return NULL;
+ }
console_input->renderer = renderer;
console_input->mode = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT | ENABLE_INSERT_MODE |
@@ -323,8 +327,9 @@ static struct object *create_console_input( struct thread* renderer, int fd )
if (!console_input->history || (renderer && !console_input->evt) || !console_input->event)
{
- release_object( console_input );
- return NULL;
+ if (fd != -1) close( fd );
+ release_object( console_input );
+ return NULL;
}
if (fd != -1) /* bare console */
{
More information about the wine-cvs
mailing list