qedit: Remove redundant NULL checks before CoTaskMemFree()

Michael Stefaniuc mstefani at redhat.de
Fri Jul 8 03:11:54 CDT 2016


Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
 dlls/qedit/samplegrabber.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c
index 7cbc0f8..cd35740 100644
--- a/dlls/qedit/samplegrabber.c
+++ b/dlls/qedit/samplegrabber.c
@@ -89,8 +89,7 @@ static ULONG WINAPI Single_IEnumMediaTypes_Release(IEnumMediaTypes *iface)
     TRACE("(%p) new ref = %u\n", This, refCount);
     if (refCount == 0)
     {
-        if (This->mtype.pbFormat)
-            CoTaskMemFree(This->mtype.pbFormat);
+        CoTaskMemFree(This->mtype.pbFormat);
         CoTaskMemFree(This);
     }
     return refCount;
@@ -276,10 +275,8 @@ static void SampleGrabber_cleanup(SG_Impl *This)
         IMemInputPin_Release(This->memOutput);
     if (This->grabberIface)
         ISampleGrabberCB_Release(This->grabberIface);
-    if (This->mtype.pbFormat)
-        CoTaskMemFree(This->mtype.pbFormat);
-    if (This->bufferData)
-        CoTaskMemFree(This->bufferData);
+    CoTaskMemFree(This->mtype.pbFormat);
+    CoTaskMemFree(This->bufferData);
     if(This->seekthru_unk)
         IUnknown_Release(This->seekthru_unk);
 }
@@ -384,8 +381,7 @@ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
                 size = 0;
             EnterCriticalSection(&This->filter.csFilter);
             if (This->bufferLen != size) {
-                if (This->bufferData)
-                    CoTaskMemFree(This->bufferData);
+                CoTaskMemFree(This->bufferData);
                 This->bufferData = size ? CoTaskMemAlloc(size) : NULL;
                 This->bufferLen = size;
             }
@@ -586,8 +582,7 @@ SampleGrabber_ISampleGrabber_SetMediaType(ISampleGrabber *iface, const AM_MEDIA_
 	debugstr_guid(&type->majortype), debugstr_guid(&type->subtype),
 	type->lSampleSize,
 	debugstr_guid(&type->formattype), type->cbFormat);
-    if (This->mtype.pbFormat)
-        CoTaskMemFree(This->mtype.pbFormat);
+    CoTaskMemFree(This->mtype.pbFormat);
     This->mtype = *type;
     This->mtype.pUnk = NULL;
     if (type->cbFormat) {
@@ -936,8 +931,7 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
 	    !IsEqualGUID(&This->sg->mtype.formattype,&FORMAT_None) &&
 	    !IsEqualGUID(&This->sg->mtype.formattype,&type->formattype))
 	    return VFW_E_TYPE_NOT_ACCEPTED;
-        if (This->sg->mtype.pbFormat)
-            CoTaskMemFree(This->sg->mtype.pbFormat);
+        CoTaskMemFree(This->sg->mtype.pbFormat);
         This->sg->mtype = *type;
         This->sg->mtype.pUnk = NULL;
         if (type->cbFormat) {
-- 
2.5.5



More information about the wine-patches mailing list