summaryrefslogtreecommitdiff
path: root/trust/index.c
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-10-16 18:10:05 +0200
committerDaiki Ueno <ueno@gnu.org>2018-10-17 10:13:32 +0200
commitb10dadce5a3c921149b2c9fe0dec614f8076ebda (patch)
tree1be6432a3cd602032c4c036bcfac4fea1b1f7158 /trust/index.c
parentc76197ddbbd0c29adc2bceff2ee9f740f71d134d (diff)
build: Free memory before return{,_val}_if_* macros
Diffstat (limited to 'trust/index.c')
-rw-r--r--trust/index.c10
1 files changed, 8 insertions, 2 deletions
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;
}