From: Timo Sirainen Date: Mon, 13 Jun 2022 06:56:13 +0000 (+0300) Subject: doveadm deduplicate: Allocate memory properly for keys in hash table X-Git-Tag: 2.3.19.1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a04e1b9abf54dddb56435cf641c7316e3519be04;p=thirdparty%2Fdovecot%2Fcore.git doveadm deduplicate: Allocate memory properly for keys in hash table This caused wrong mails to be deleted somewhat randomly. Broken by 320844f50cd669b602d30210e2e5216f65d2050f --- diff --git a/src/doveadm/doveadm-mail-deduplicate.c b/src/doveadm/doveadm-mail-deduplicate.c index abe41559fb..f990287d7f 100644 --- a/src/doveadm/doveadm-mail-deduplicate.c +++ b/src/doveadm/doveadm-mail-deduplicate.c @@ -61,8 +61,10 @@ cmd_deduplicate_box(struct doveadm_mail_cmd_context *_ctx, if (key != NULL && *key != '\0') { if (hash_table_lookup(hash, key) != NULL) mail_expunge(mail); - else + else { + key = p_strdup(pool, key); hash_table_insert(hash, key, POINTER_CAST(1)); + } } }