From 4f19d45af9df9dc6735b0f8675a2b53470df76d6 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 9 Nov 2005 19:31:02 +0000 Subject: [PATCH] wrap free() for use w/ dmalloc --- src/sigar_cache.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sigar_cache.c b/src/sigar_cache.c index 09f7e872..79f6a8dd 100644 --- a/src/sigar_cache.c +++ b/src/sigar_cache.c @@ -13,6 +13,12 @@ #define ENTRIES_SIZE(n) \ (sizeof(sigar_cache_entry_t *) * (n)) +/* wrap free() for use w/ dmalloc */ +static void free_value(void *ptr) +{ + free(ptr); +} + sigar_cache_t *sigar_cache_new(int size) { sigar_cache_t *table = malloc(sizeof(*table)); @@ -20,7 +26,7 @@ sigar_cache_t *sigar_cache_new(int size) table->size = size; table->entries = malloc(ENTRIES_SIZE(size)); memset(table->entries, '\0', ENTRIES_SIZE(size)); - table->free_value = free; + table->free_value = free_value; return table; }