summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-10-17 09:53:46 +0200
committerDaiki Ueno <ueno@gnu.org>2018-10-17 10:13:32 +0200
commit83e92c2f9575707083d8b0c70ef330e285d70836 (patch)
treee9de300bfc834ddabded619cbb4e77801ad4af35
parent6417780ebbbbb0f01ddb001b239347655fb98578 (diff)
trust: Check index->buckets is allocated on cleanup
-rw-r--r--trust/index.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/trust/index.c b/trust/index.c
index 6a8e535..2d1da29 100644
--- a/trust/index.c
+++ b/trust/index.c
@@ -193,9 +193,11 @@ p11_index_free (p11_index *index)
p11_dict_free (index->objects);
p11_dict_free (index->changes);
- for (i = 0; i < NUM_BUCKETS; i++)
- free (index->buckets[i].elem);
- free (index->buckets);
+ if (index->buckets) {
+ for (i = 0; i < NUM_BUCKETS; i++)
+ free (index->buckets[i].elem);
+ free (index->buckets);
+ }
free (index);
}