Marcus Meissner : qcap: Fixed a use after free in error path (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Aug 20 14:16:17 CDT 2012


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

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Fri Aug 17 23:04:31 2012 +0200

qcap: Fixed a use after free in error path (Coverity).

---

 dlls/qcap/v4l.c        |    1 +
 dlls/qcap/vfwcapture.c |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index 119eb29..1851ba4 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -314,6 +314,7 @@ HRESULT qcap_driver_get_format(const Capture *capBox, AM_MEDIA_TYPE ** mT)
     if (!vi)
     {
         CoTaskMemFree(mT[0]);
+        mT[0] = NULL;
         return E_OUTOFMEMORY;
     }
     mT[0]->majortype = MEDIATYPE_Video;
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index 68341ae..7be59cc 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -678,9 +678,10 @@ static HRESULT WINAPI VfwPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDI
         return VFW_S_NO_MORE_ITEMS;
 
     hr = qcap_driver_get_format(This->driver_info, &vfw_pmt);
-    CopyMediaType(pmt, vfw_pmt);
-    DeleteMediaType(vfw_pmt);
-
+    if (SUCCEEDED(hr)) {
+        CopyMediaType(pmt, vfw_pmt);
+        DeleteMediaType(vfw_pmt);
+    }
     return hr;
 }
 




More information about the wine-cvs mailing list