Jon Griffiths : oleaut32/test: Fix valgrind leaks.

Alexandre Julliard julliard at winehq.org
Mon Jul 7 09:19:26 CDT 2008


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

Author: Jon Griffiths <jon_p_griffiths at yahoo.com>
Date:   Sun Jul  6 09:21:08 2008 -0700

oleaut32/test: Fix valgrind leaks.

---

 dlls/oleaut32/tests/varformat.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c
index 2b60c96..228ad1c 100644
--- a/dlls/oleaut32/tests/varformat.c
+++ b/dlls/oleaut32/tests/varformat.c
@@ -64,9 +64,11 @@ static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 )
   VariantInit(&v); V_VT(&v) = vt; val(&v) = 1; \
   hres = pVarFormatNumber(&v,2,0,0,0,0,&str); \
   ok(hres == S_OK, "VarFormatNumber (vt %d): returned %8x\n", vt, hres); \
-  if (hres == S_OK) \
+  if (hres == S_OK) { \
     ok(str && strcmpW(str,szResult1) == 0, \
-       "VarFormatNumber (vt %d): string different\n", vt)
+       "VarFormatNumber (vt %d): string different\n", vt); \
+    if (str) SysFreeString(str); \
+  }
 
 static void test_VarFormatNumber(void)
 {
@@ -126,7 +128,7 @@ static void test_VarFormatNumber(void)
 
 static const char *szVarFmtFail = "VT %d|0x%04x Format %s: expected 0x%08x, '%s', got 0x%08x, '%s'\n";
 #define VARFMT(vt,v,val,fmt,ret,str) do { \
-  if (out) SysFreeString(out); out = NULL; \
+  out = NULL; \
   V_VT(&in) = (vt); v(&in) = val; \
   if (fmt) MultiByteToWideChar(CP_ACP, 0, fmt, -1, buffW, sizeof(buffW)/sizeof(WCHAR)); \
   hres = pVarFormat(&in,fmt ? buffW : NULL,fd,fw,flags,&out); \
@@ -135,6 +137,7 @@ static const char *szVarFmtFail = "VT %d|0x%04x Format %s: expected 0x%08x, '%s'
   ok(hres == ret && (FAILED(ret) || !strcmp(buff, str)), \
      szVarFmtFail, \
      (vt)&VT_TYPEMASK,(vt)&~VT_TYPEMASK,fmt?fmt:"<null>",ret,str,hres,buff); \
+  if (out) SysFreeString(out); \
   } while(0)
 
 typedef struct tagFMTRES




More information about the wine-cvs mailing list