quartz: Cleanup properly around error conditions and avoid a potential infinite loop

Chris Robinson chris.kcat at gmail.com
Tue Mar 13 12:57:17 CDT 2007


-------------- next part --------------
From 1a8e882bf60a38f1828a75831c194d1a401ed061 Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat at gmail.com>
Date: Tue, 13 Mar 2007 10:21:17 -0700
Subject: [PATCH] quartz: Cleanup properly around error conditions and avoid a potential infinite loop

---
 dlls/quartz/acmwrapper.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c
index 4b2d143..344779c 100644
--- a/dlls/quartz/acmwrapper.c
+++ b/dlls/quartz/acmwrapper.c
@@ -78,7 +78,7 @@ static HRESULT ACMWrapper_ProcessSampleData(TransformFilterImpl* pTransformFilte
     hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
     if (FAILED(hr)) {
 	ERR("Unable to retrieve media type\n");
-	goto error;
+	return hr;
     }
 
     while(!stop)
@@ -99,7 +99,7 @@ static HRESULT ACMWrapper_ProcessSampleData(TransformFilterImpl* pTransformFilte
 	hr = OutputPin_GetDeliveryBuffer((OutputPin*)This->tf.ppPins[1], &pSample, NULL, NULL, 0);
 	if (FAILED(hr)) {
 	    ERR("Unable to get delivery buffer (%x)\n", hr);
-	    goto error;
+	    return hr;
 	}
 
 	hr = IMediaSample_SetActualDataLength(pSample, 0);
@@ -152,11 +152,13 @@ static HRESULT ACMWrapper_ProcessSampleData(TransformFilterImpl* pTransformFilte
         }
 
 error:
-	if (unprepare_header && (res = acmStreamUnprepareHeader(This->has, &ash, 0)))
-	    ERR("Cannot unprepare header %d\n", res);
+        if (unprepare_header && (res = acmStreamUnprepareHeader(This->has, &ash, 0)))
+            ERR("Cannot unprepare header %d\n", res);
+        unprepare_header = FALSE;
 
-	if (pSample)
-	    IMediaSample_Release(pSample);
+        if (pSample)
+            IMediaSample_Release(pSample);
+        pSample = NULL;
     }
 
     return hr;
-- 
1.4.4.4



More information about the wine-patches mailing list