diff options
author | Ryan Pavlik <rpavlik@iastate.edu> | 2011-10-28 09:46:45 -0500 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-01-07 22:49:51 +0000 |
commit | cc7dedd6b51a01996ddab10fe8b84e30700d1570 (patch) | |
tree | fb976e324fa00ff72b0d4c4c15a40d9405e1387b /hw/xwin | |
parent | 98cde254acb9b98337ddecf64c138d38c14ec2bf (diff) |
hw/xwin: Fix a memory leak in error path in winInitWM()
Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/winmultiwindowwm.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 67a58a076..7c4056388 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -1201,11 +1201,13 @@ winInitWM (void **ppWMInfo, XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec)); /* Bail if the input parameters are bad */ - if (pArg == NULL || pWMInfo == NULL) - { - ErrorF ("winInitWM - malloc failed.\n"); - return FALSE; - } + if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) { + ErrorF ("winInitWM - malloc failed.\n"); + free(pArg); + free(pWMInfo); + free(pXMsgArg); + return FALSE; + } /* Zero the allocated memory */ ZeroMemory (pArg, sizeof (WMProcArgRec)); |