Marcus Meissner : msacm32: Add missing HeapALloc failure checks (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Feb 2 09:01:19 CST 2009


Module: wine
Branch: master
Commit: f0b685d5045e12ba670ee69fcf032e2fec60b42e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f0b685d5045e12ba670ee69fcf032e2fec60b42e

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Sat Jan 31 21:53:36 2009 +0100

msacm32: Add missing HeapALloc failure checks (Coverity).

---

 dlls/msacm32/internal.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/dlls/msacm32/internal.c b/dlls/msacm32/internal.c
index cf76a57..4100aae 100644
--- a/dlls/msacm32/internal.c
+++ b/dlls/msacm32/internal.c
@@ -289,18 +289,29 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileNa
           debugstr_w(pszDriverAlias), debugstr_w(pszFileName), pLocalDriver);
 
     padid = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
+    if (!padid)
+        return NULL;
     padid->obj.dwType = WINE_ACMOBJ_DRIVERID;
     padid->obj.pACMDriverID = padid;
     padid->pszDriverAlias = NULL;
     if (pszDriverAlias)
     {
         padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
+        if (!padid->pszDriverAlias) {
+            HeapFree(MSACM_hHeap, 0, padid);
+            return NULL;
+        }
         strcpyW( padid->pszDriverAlias, pszDriverAlias );
     }
     padid->pszFileName = NULL;
     if (pszFileName)
     {
         padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) );
+        if (!padid->pszFileName) {
+            HeapFree(MSACM_hHeap, 0, padid->pszDriverAlias);
+            HeapFree(MSACM_hHeap, 0, padid);
+            return NULL;
+        }
         strcpyW( padid->pszFileName, pszFileName );
     }
     padid->pLocalDriver = pLocalDriver;




More information about the wine-cvs mailing list