Commit 29d4ab13 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

d3dxof: Release properly all allocated resources.

parent 23a3552d
...@@ -1538,7 +1538,14 @@ static ULONG WINAPI IDirectXFileDataImpl_Release(IDirectXFileData* iface) ...@@ -1538,7 +1538,14 @@ static ULONG WINAPI IDirectXFileDataImpl_Release(IDirectXFileData* iface)
TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref); TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref);
if (!ref) if (!ref)
{
if (!This->level)
{
HeapFree(GetProcessHeap(), 0, This->pdata);
HeapFree(GetProcessHeap(), 0, This->pstrings);
}
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
}
return ref; return ref;
} }
...@@ -1902,7 +1909,10 @@ static ULONG WINAPI IDirectXFileEnumObjectImpl_Release(IDirectXFileEnumObject* i ...@@ -1902,7 +1909,10 @@ static ULONG WINAPI IDirectXFileEnumObjectImpl_Release(IDirectXFileEnumObject* i
if (!ref) if (!ref)
{ {
CloseHandle(This->hFile); if (This->source == DXFILELOAD_FROMFILE)
HeapFree(GetProcessHeap(), 0, This->buf.buffer);
if (This->hFile != INVALID_HANDLE_VALUE)
CloseHandle(This->hFile);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
...@@ -2258,7 +2268,7 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE ...@@ -2258,7 +2268,7 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
hr = DXFILEERR_BADALLOC; hr = DXFILEERR_BADALLOC;
goto error; goto error;
} }
This->buf.cur_pdata = This->buf.pdata = pdata; This->buf.cur_pdata = This->buf.pdata = object->pdata = pdata;
pstrings = HeapAlloc(GetProcessHeap(), 0, MAX_STRINGS_BUFFER); pstrings = HeapAlloc(GetProcessHeap(), 0, MAX_STRINGS_BUFFER);
if (!pstrings) if (!pstrings)
...@@ -2267,7 +2277,7 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE ...@@ -2267,7 +2277,7 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
hr = DXFILEERR_BADALLOC; hr = DXFILEERR_BADALLOC;
goto error; goto error;
} }
This->buf.cur_pstrings = This->buf.pstrings = pstrings; This->buf.cur_pstrings = This->buf.pstrings = object->pstrings = pstrings;
if (!parse_object(&This->buf)) if (!parse_object(&This->buf))
{ {
......
...@@ -104,6 +104,7 @@ typedef struct { ...@@ -104,6 +104,7 @@ typedef struct {
int cur_enum_object; int cur_enum_object;
BOOL from_ref; BOOL from_ref;
ULONG level; ULONG level;
LPBYTE pdata;
LPBYTE pstrings; LPBYTE pstrings;
} IDirectXFileDataImpl; } IDirectXFileDataImpl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment