From 54a41aacdf40fefe2b8dfa372f8cd0c132c0042f Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 11 Sep 2013 14:41:59 +0100 Subject: [PATCH] bitset: Add a bitset_free() function --- src/bitset.h | 6 ++++++ src/mirror.c | 2 +- src/serve.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bitset.h b/src/bitset.h index 75fa6d7..4c3586c 100644 --- a/src/bitset.h +++ b/src/bitset.h @@ -141,6 +141,12 @@ static inline struct bitset_mapping* bitset_alloc( return bitset; } +static inline void bitset_free( struct bitset_mapping * set ) +{ + /* TODO: free our mutex... */ + free( set ); +} + #define INT_FIRST_AND_LAST \ uint64_t first = from/set->resolution, \ last = ((from+len)-1)/set->resolution, \ diff --git a/src/mirror.c b/src/mirror.c index e25103d..41a7ac4 100644 --- a/src/mirror.c +++ b/src/mirror.c @@ -206,7 +206,7 @@ void mirror_destroy( struct mirror *mirror ) self_pipe_destroy( mirror->abandon_signal ); free(mirror->connect_to); free(mirror->connect_from); - free(mirror->dirty_map); + bitset_free( mirror->dirty_map ); free(mirror); } diff --git a/src/serve.c b/src/serve.c index 394b048..a6e29b1 100644 --- a/src/serve.c +++ b/src/serve.c @@ -830,7 +830,7 @@ void serve_cleanup(struct server* params, pthread_cancel(params->allocation_map_builder_thread); pthread_join(params->allocation_map_builder_thread, &status); if (params->allocation_map) { - free(params->allocation_map); + bitset_free( params->allocation_map ); } int need_mirror_lock;