Marcus Meissner : d3drm: Added some freeing of memory in error paths ( Coverity).

Alexandre Julliard julliard at winehq.org
Mon Oct 14 12:39:28 CDT 2013


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

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Sun Oct 13 11:13:32 2013 +0200

d3drm: Added some freeing of memory in error paths (Coverity).

---

 dlls/d3drm/frame.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c
index ea20d15..36baf2e 100644
--- a/dlls/d3drm/frame.c
+++ b/dlls/d3drm/frame.c
@@ -758,7 +758,10 @@ static HRESULT WINAPI d3drm_frame2_GetVisuals(IDirect3DRMFrame2 *iface, IDirect3
         ULONG i;
 
         if (!(array->visuals = HeapAlloc(GetProcessHeap(), 0, frame->nb_visuals * sizeof(*array->visuals))))
+        {
+            HeapFree(GetProcessHeap(), 0, array);
             return E_OUTOFMEMORY;
+        }
         for (i = 0; i < frame->nb_visuals; ++i)
         {
             array->visuals[i] = frame->visuals[i];
@@ -1506,7 +1509,10 @@ static HRESULT WINAPI d3drm_frame3_GetChildren(IDirect3DRMFrame3 *iface, IDirect
         ULONG i;
 
         if (!(array->frames = HeapAlloc(GetProcessHeap(), 0, frame->nb_children * sizeof(*array->frames))))
+        {
+            HeapFree(GetProcessHeap(), 0, array);
             return E_OUTOFMEMORY;
+        }
         for (i = 0; i < frame->nb_children; ++i)
         {
             IDirect3DRMFrame3_QueryInterface(frame->children[i], &IID_IDirect3DRMFrame, (void **)&array->frames[i]);
@@ -1544,7 +1550,10 @@ static HRESULT WINAPI d3drm_frame3_GetLights(IDirect3DRMFrame3 *iface, IDirect3D
         ULONG i;
 
         if (!(array->lights = HeapAlloc(GetProcessHeap(), 0, frame->nb_lights * sizeof(*array->lights))))
+        {
+            HeapFree(GetProcessHeap(), 0, array);
             return E_OUTOFMEMORY;
+        }
         for (i = 0; i < frame->nb_lights; ++i)
         {
             IDirect3DRMLight_QueryInterface(frame->lights[i], &IID_IDirect3DRMLight, (void **)&array->lights[i]);




More information about the wine-cvs mailing list