From 5ef492c5635ae1677eed6f439a75a86a99dbbe18 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 19 Jul 2018 20:38:21 +0200 Subject: core: Clear all flags for a new data property. * src/data.c (PROPERTY_TABLE_ALLOCATION_CHUNK): New. (insert_into_property_table): Use it here. Clear all flags. -- Fixes-commit: 085cdeddef637cc057362fcbde13b0261b8699ec Signed-off-by: Werner Koch --- src/data.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/data.c') diff --git a/src/data.c b/src/data.c index e826f102..1df6b0a1 100644 --- a/src/data.c +++ b/src/data.c @@ -63,6 +63,7 @@ typedef struct property_s *property_t; static property_t property_table; static unsigned int property_table_size; DEFINE_STATIC_LOCK (property_table_lock); +#define PROPERTY_TABLE_ALLOCATION_CHUNK 32 @@ -79,7 +80,7 @@ insert_into_property_table (gpgme_data_t dh, unsigned int *r_idx) LOCK (property_table_lock); if (!property_table) { - property_table_size = 10; + property_table_size = PROPERTY_TABLE_ALLOCATION_CHUNK; property_table = calloc (property_table_size, sizeof *property_table); if (!property_table) { @@ -98,7 +99,7 @@ insert_into_property_table (gpgme_data_t dh, unsigned int *r_idx) property_t newtbl; unsigned int newsize; - newsize = property_table_size + 10; + newsize = property_table_size + PROPERTY_TABLE_ALLOCATION_CHUNK;; if ((newsize * sizeof *property_table) < (property_table_size * sizeof *property_table)) { @@ -121,6 +122,7 @@ insert_into_property_table (gpgme_data_t dh, unsigned int *r_idx) /* Slot found. */ property_table[idx].dh = dh; property_table[idx].dserial = ++last_dserial; + memset (&property_table[idx].flags, 0, sizeof property_table[idx].flags); *r_idx = idx; err = 0; -- cgit v1.2.3