From 7a14c960194f3b417d06fb85267591fad0fb1b87 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 9 Oct 2012 13:22:08 +0800 Subject: fixes memory leak in test_memory_chunk --- tests/include/test_memory_chunk.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tests/include') diff --git a/tests/include/test_memory_chunk.cpp b/tests/include/test_memory_chunk.cpp index 4920424..eefc357 100644 --- a/tests/include/test_memory_chunk.cpp +++ b/tests/include/test_memory_chunk.cpp @@ -58,14 +58,10 @@ int main(int argc, char * argv[]){ assert(chunk->get_content(sizeof(int), &tmp, sizeof(int))); printf("%d\n", tmp); - //clean up chunk - delete chunk; - const char * filename = "/tmp/version"; const char * version = "0.2.0"; - //testing version check. - chunk = new MemoryChunk; + /* testing version check. */ bool retval = chunk->load(filename); if ( !retval ){ fprintf(stderr, "can't find chunk\n"); @@ -83,5 +79,7 @@ int main(int argc, char * argv[]){ printf("match\n"); } + delete chunk; + return 0; } -- cgit