summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/coucal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/coucal.c b/src/coucal.c
index e84c512..82dfeff 100644
--- a/src/coucal.c
+++ b/src/coucal.c
@@ -765,9 +765,11 @@ static void coucal_default_free_handler(coucal_opaque arg,
}
static INTHASH_INLINE void coucal_del_value_(coucal hashtable, coucal_value *pvalue) {
- if (hashtable->custom.value.free != NULL)
- hashtable->custom.value.free(hashtable->custom.value.arg, *pvalue);
- pvalue->ptr = NULL;
+ if (pvalue->ptr != NULL) {
+ if (hashtable->custom.value.free != NULL)
+ hashtable->custom.value.free(hashtable->custom.value.arg, *pvalue);
+ pvalue->ptr = NULL;
+ }
}
static INTHASH_INLINE void coucal_del_value(coucal hashtable, size_t pos) {