use function pointer to free value

This commit is contained in:
Doug MacEachern committed 2004-12-05 20:48:35 +00:00
1 parent 72b3a4c55b
commit 6852882203
2 files changed
+3 -1

No files matched your search

+2 -1
View File
@@ -20,6 +20,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;
return table;
}
@@ -71,7 +72,7 @@ void sigar_cache_destroy(sigar_cache_t *table)
do {
if (ptr->value) {
free(ptr->value);
table->free_value(ptr->value);
}
} while ((ptr = ptr->next));
free(entry);