Michael Stefaniuc : qedit: Remove redundant NULL checks before CoTaskMemFree().

Alexandre Julliard julliard at winehq.org
Fri Jul 8 10:02:05 CDT 2016


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Fri Jul  8 10:11:54 2016 +0200

qedit: Remove redundant NULL checks before CoTaskMemFree().

Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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) {




More information about the wine-cvs mailing list