Module: wine Branch: master Commit: efebe8b29bc2c984cf07e38c7048689120217a1a URL: http://source.winehq.org/git/wine.git/?a=commit;h=efebe8b29bc2c984cf07e38c70...
Author: Lionel Debroux lionel_debroux@yahoo.fr Date: Fri Oct 26 11:15:26 2007 +0200
msvcrt/tests: Fix memory leak (found by Smatch).
---
dlls/msvcrt/tests/string.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 6dabc61..66b018a 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -388,7 +388,7 @@ static void test_strdup(void)
START_TEST(string) { - void *mem; + char mem[100]; static const char xilstring[]="c:/xilinx"; int nLen;
@@ -401,13 +401,11 @@ START_TEST(string)
/* MSVCRT memcpy behaves like memmove for overlapping moves, MFC42 CString::Insert seems to rely on that behaviour */ - mem = malloc(100); - ok(mem != NULL, "memory not allocated for size 0\n"); - strcpy((char*)mem,xilstring); + strcpy(mem,xilstring); nLen=strlen(xilstring); - pmemcpy((char*)mem+5, mem,nLen+1); - ok(pmemcmp((char*)mem+5,xilstring, nLen) == 0, - "Got result %s\n",(char*)mem+5); + pmemcpy(mem+5, mem,nLen+1); + ok(pmemcmp(mem+5,xilstring, nLen) == 0, + "Got result %s\n",mem+5);
/* Test _swab function */ test_swab();