Juan Lang : quartz: Don' t crash in SetMediaType if the source media type is NULL.

Alexandre Julliard julliard at winehq.org
Fri Dec 3 09:31:38 CST 2010


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Dec  2 09:23:38 2010 -0800

quartz: Don't crash in SetMediaType if the source media type is NULL.

---

 dlls/quartz/memallocator.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index 3e79a12..575af9d 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -661,8 +661,13 @@ static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MED
     TRACE("(%p)->(%p)\n", iface, pMediaType);
 
     if (This->props.pMediaType)
+    {
         FreeMediaType(This->props.pMediaType);
-    else if (!(This->props.pMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
+        This->props.pMediaType = NULL;
+    }
+    if (!pMediaType)
+        return S_FALSE;
+    if (!(This->props.pMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
         return E_OUTOFMEMORY;
 
     return CopyMediaType(This->props.pMediaType, pMediaType);




More information about the wine-cvs mailing list