aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-07-19 18:38:21 +0000
committerWerner Koch <[email protected]>2018-07-19 18:38:21 +0000
commit5ef492c5635ae1677eed6f439a75a86a99dbbe18 (patch)
tree40c131e69c1f192165240b565bd7a1f941a50c08 /src/data.c
parentcore: Blank out the plaintext after decryption failure. (diff)
downloadgpgme-5ef492c5635ae1677eed6f439a75a86a99dbbe18.tar.gz
gpgme-5ef492c5635ae1677eed6f439a75a86a99dbbe18.zip
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 <[email protected]>
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c6
1 files changed, 4 insertions, 2 deletions
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;