Thanks janderwald you did think it was something wrong with the pointer This at begin...
authorMagnus Olsen <magnus@greatlord.com>
Tue, 19 Dec 2006 22:33:22 +0000 (22:33 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Tue, 19 Dec 2006 22:33:22 +0000 (22:33 +0000)
1. if some idot send in iPface is NULL to DirectDrawCreate/DirectDrawCreateEx  (example DirectDrawCreate/DirectDrawCreateEx(NULL,NULL,NULL)) we do not free the alloc memory at fail.

svn path=/trunk/; revision=25194

reactos/dll/directx/ddraw/startup.c

index ab4e44d..6dce0a1 100644 (file)
@@ -895,10 +895,22 @@ Create_DirectDraw (LPGUID pGUID,
 
     if (This == NULL)
     {
-        /* We do not have any DirectDraw interface alloc */
-        This = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
+        LPDDRAWI_DIRECTDRAW_INT memThis;
+        
+       /* We do not have any DirectDraw interface alloc 
+        * or a idot send in pIface as NULL
+        */
+        memThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
+        This = memThis;
         if (This == NULL) 
         {
+            if (memThis != NULL)
+            {
+                /* do not create memmory leak if some 
+                 * idot send in pIface as NULL
+                 */
+                DxHeapMemFree(memThis);
+            }
             return DDERR_OUTOFMEMORY;
         }
     }