# HG changeset patch # User Olaf Wintermann # Date 1350036006 -7200 # Node ID 6721482eaf8e8d35b1cd46f0a21285bfaa520d5a # Parent fb59270b1de36905091cfaa81295cf9ac487bdd7 fixed memory leak in ucx_map_rehash diff -r fb59270b1de3 -r 6721482eaf8e ucx/map.c --- a/ucx/map.c Fri Oct 12 10:54:55 2012 +0200 +++ b/ucx/map.c Fri Oct 12 12:00:06 2012 +0200 @@ -28,7 +28,7 @@ return map; } -void ucx_map_free(UcxMap *map) { +void ucx_map_free_elmlist(UcxMap *map) { for (size_t n = 0 ; n < map->size ; n++) { UcxMapElement *elem = map->map[n]; if (elem != NULL) { @@ -41,6 +41,10 @@ } } free(map->map); +} + +void ucx_map_free(UcxMap *map) { + ucx_map_free_elmlist(map); free(map); } @@ -83,7 +87,9 @@ } map->count = 0; ucx_map_copy(&oldmap, map, NULL, NULL); - /* TODO: free the UcxMapElement list of oldmap */ + + /* free the UcxMapElement list of oldmap */ + ucx_map_free_elmlist(&oldmap); } return 0; } diff -r fb59270b1de3 -r 6721482eaf8e ucx/test.h --- a/ucx/test.h Fri Oct 12 10:54:55 2012 +0200 +++ b/ucx/test.h Fri Oct 12 12:00:06 2012 +0200 @@ -61,7 +61,7 @@ void ucx_test_register(UcxTestSuite*, UcxTest); void ucx_test_run(UcxTestSuite*, FILE*); -#define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *); +#define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *) #define UCX_TEST_IMPLEMENT(name) void name(UcxTestSuite* _suite_,FILE *_output_) #define UCX_TEST_BEGIN fwrite("Running ", 1, 8, _output_);\