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>
This commit is contained in:
Ryan Pavlik 2011-10-28 09:46:45 -05:00 committed by Jon TURNEY
parent 98cde254ac
commit cc7dedd6b5

View File

@ -1201,11 +1201,13 @@ winInitWM (void **ppWMInfo,
XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec)); XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec));
/* Bail if the input parameters are bad */ /* Bail if the input parameters are bad */
if (pArg == NULL || pWMInfo == NULL) if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) {
{ ErrorF ("winInitWM - malloc failed.\n");
ErrorF ("winInitWM - malloc failed.\n"); free(pArg);
return FALSE; free(pWMInfo);
} free(pXMsgArg);
return FALSE;
}
/* Zero the allocated memory */ /* Zero the allocated memory */
ZeroMemory (pArg, sizeof (WMProcArgRec)); ZeroMemory (pArg, sizeof (WMProcArgRec));