Fri, 12 Oct 2012 12:00:06 +0200
fixed memory leak in ucx_map_rehash
ucx/map.c | file | annotate | diff | comparison | revisions | |
ucx/test.h | file | annotate | diff | comparison | revisions |
1.1 --- a/ucx/map.c Fri Oct 12 10:54:55 2012 +0200 1.2 +++ b/ucx/map.c Fri Oct 12 12:00:06 2012 +0200 1.3 @@ -28,7 +28,7 @@ 1.4 return map; 1.5 } 1.6 1.7 -void ucx_map_free(UcxMap *map) { 1.8 +void ucx_map_free_elmlist(UcxMap *map) { 1.9 for (size_t n = 0 ; n < map->size ; n++) { 1.10 UcxMapElement *elem = map->map[n]; 1.11 if (elem != NULL) { 1.12 @@ -41,6 +41,10 @@ 1.13 } 1.14 } 1.15 free(map->map); 1.16 +} 1.17 + 1.18 +void ucx_map_free(UcxMap *map) { 1.19 + ucx_map_free_elmlist(map); 1.20 free(map); 1.21 } 1.22 1.23 @@ -83,7 +87,9 @@ 1.24 } 1.25 map->count = 0; 1.26 ucx_map_copy(&oldmap, map, NULL, NULL); 1.27 - /* TODO: free the UcxMapElement list of oldmap */ 1.28 + 1.29 + /* free the UcxMapElement list of oldmap */ 1.30 + ucx_map_free_elmlist(&oldmap); 1.31 } 1.32 return 0; 1.33 }
2.1 --- a/ucx/test.h Fri Oct 12 10:54:55 2012 +0200 2.2 +++ b/ucx/test.h Fri Oct 12 12:00:06 2012 +0200 2.3 @@ -61,7 +61,7 @@ 2.4 void ucx_test_register(UcxTestSuite*, UcxTest); 2.5 void ucx_test_run(UcxTestSuite*, FILE*); 2.6 2.7 -#define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *); 2.8 +#define UCX_TEST_DECLARE(name) void name(UcxTestSuite*,FILE *) 2.9 #define UCX_TEST_IMPLEMENT(name) void name(UcxTestSuite* _suite_,FILE *_output_) 2.10 2.11 #define UCX_TEST_BEGIN fwrite("Running ", 1, 8, _output_);\