Author: pschweitzer
Date: Wed Dec 7 22:16:00 2011
New Revision: 54610
URL:
http://svn.reactos.org/svn/reactos?rev=54610&view=rev
Log:
[MSACM32]
Check allocation success.
Prevent buffer double free.
Already sent & committed upstream:
http://source.winehq.org/git/wine.git/commit/1ac7096728dbb46a56f84fa0d25fdc…
Modified:
trunk/reactos/dll/win32/msacm32/internal.c
Modified: trunk/reactos/dll/win32/msacm32/internal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msacm32/internal…
==============================================================================
--- trunk/reactos/dll/win32/msacm32/internal.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msacm32/internal.c [iso-8859-1] Wed Dec 7 22:16:00 2011
@@ -1007,6 +1007,9 @@
PWINE_ACMLOCALDRIVERINST pDrvInst;
pDrvInst = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVERINST));
+ if (!pDrvInst)
+ return NULL;
+
pDrvInst->pLocalDriver = paldrv;
pDrvInst->dwDriverID = 0;
pDrvInst->pNextACMInst = NULL;
@@ -1028,9 +1031,14 @@
ret = MSACM_OpenLocalDriver(paldrv, lParam2);
if (!ret)
{
- MSACM_CloseLocalDriver(pDrvInst);
ERR("load1 failed\n");
- goto exit;
+ /* If MSACM_CloseLocalDriver returns TRUE,
+ * then pDrvInst has been freed
+ */
+ if (!MSACM_CloseLocalDriver(pDrvInst))
+ goto exit;
+
+ return NULL;
}
pDrvInst->bSession = TRUE;
return ret;