Bruno Jesus : msvfw32: Simplify error handling in ICSeqCompressFrameStart.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 19 11:34:20 CDT 2015


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

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Mon Oct 19 17:47:56 2015 +0800

msvfw32: Simplify error handling in ICSeqCompressFrameStart.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvfw32/msvideo_main.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index db56fdf..5aff706 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -1433,28 +1433,18 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
     *pc->lpbiIn = *lpbiIn;
     pc->lpBitsPrev = HeapAlloc(GetProcessHeap(), 0, pc->lpbiIn->bmiHeader.biSizeImage);
     if (!pc->lpBitsPrev)
-    {
-        HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
-	return FALSE;
-    }
+        goto error;
 
     pc->lpState = HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS));
     if (!pc->lpState)
-    {
-       HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
-       HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
-       return FALSE;
-    }
+        goto error;
+
     pc->cbState = sizeof(ICCOMPRESS);
 
     pc->lpBitsOut = HeapAlloc(GetProcessHeap(), 0, pc->lpbiOut->bmiHeader.biSizeImage);
     if (!pc->lpBitsOut)
-    {
-       HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
-       HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
-       HeapFree(GetProcessHeap(), 0, pc->lpState);
-       return FALSE;
-    }
+        goto error;
+
     TRACE("Compvars:\n"
           "\tpc:\n"
           "\tsize: %i\n"
@@ -1483,6 +1473,7 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
        icComp->lpbiPrev = &pc->lpbiIn->bmiHeader;
        return TRUE;
     }
+error:
     HeapFree(GetProcessHeap(), 0, pc->lpbiIn);
     HeapFree(GetProcessHeap(), 0, pc->lpBitsPrev);
     HeapFree(GetProcessHeap(), 0, pc->lpState);




More information about the wine-cvs mailing list