From b10dadce5a3c921149b2c9fe0dec614f8076ebda Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 16 Oct 2018 18:10:05 +0200 Subject: build: Free memory before return{,_val}_if_* macros --- trust/index.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'trust/index.c') diff --git a/trust/index.c b/trust/index.c index f4b6b4b..6a8e535 100644 --- a/trust/index.c +++ b/trust/index.c @@ -170,10 +170,16 @@ p11_index_new (p11_index_build_cb build, index->objects = p11_dict_new (p11_dict_ulongptr_hash, p11_dict_ulongptr_equal, NULL, free_object); - return_val_if_fail (index->objects != NULL, NULL); + if (index->objects == NULL) { + p11_index_free (index); + return_val_if_reached (NULL); + } index->buckets = calloc (NUM_BUCKETS, sizeof (index_bucket)); - return_val_if_fail (index->buckets != NULL, NULL); + if (index->buckets == NULL) { + p11_index_free (index); + return_val_if_reached (NULL); + } return index; } -- cgit v1.1