From 0cf81a0aa8fd8dc7de56d9cfeda1a587bcdf6660 Mon Sep 17 00:00:00 2001 From: MuQun Yang Date: Sat, 25 Nov 2000 17:30:59 -0500 Subject: [svn-r3001] Purpose: Fix a bug caught by debug version of windows 2000 at test_compound_5(struct optimization converter). Description: free memory of a variable before checking the result by using that variable. Solution: put free(buf) and free(bkg) after the following block: /* Check results */ if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim!=dst[1].tdim || src[1].coll_ids[0]!=dst[1].coll_ids[0] || src[1].coll_ids[1]!=dst[1].coll_ids[1] || src[1].coll_ids[2]!=dst[1].coll_ids[2] || src[1].coll_ids[3]!=dst[1].coll_ids[3]) { FAILED(); return 1; } Platforms tested: windows 2000 and confirmed at LINUX(eirene). --- test/dtypes.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/dtypes.c b/test/dtypes.c index 6f5d439..264af69 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -853,9 +853,7 @@ test_compound_5(void) H5Tclose(short_array); H5Tclose(int_array); - /* Free memory buffers */ - free(buf); - free(bkg); + /* Check results */ if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || @@ -867,6 +865,10 @@ test_compound_5(void) FAILED(); return 1; } + + /* Free memory buffers */ + free(buf); + free(bkg); PASSED(); return 0; } -- cgit v0.12