aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2017-02-01 17:03:35 +0000
committerAndre Heinecke <[email protected]>2017-02-01 17:06:22 +0000
commitb5075030bec9b21bf4e515bc1686df3fa43eced2 (patch)
treed8f37fd1e593fc875e720a6fbcf844bd10af69f2
parentcore: Improve mailbox only uid handling (diff)
downloadgpgme-b5075030bec9b21bf4e515bc1686df3fa43eced2.tar.gz
gpgme-b5075030bec9b21bf4e515bc1686df3fa43eced2.zip
core: Fix leakage of address for mail only uids
* src/key.c (gpgme_key_unref): Always free address if set. (_gpgme_key_append_name): Remove memory optimization for address. -- The check if address is not allocated would now be more complicated then just comparing it to email because email is set to address also when an email was not parsed from the user id.
-rw-r--r--src/key.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/key.c b/src/key.c
index fed020e7..e33abd0f 100644
--- a/src/key.c
+++ b/src/key.c
@@ -236,12 +236,6 @@ _gpgme_key_append_name (gpgme_key_t key, const char *src, int convert)
&uid->comment, dst);
uid->address = _gpgme_mailbox_from_userid (uid->uid);
- if (uid->address && uid->email && !strcmp (uid->address, uid->email))
- {
- /* The ADDRESS is the same as EMAIL: Save some space. */
- free (uid->address);
- uid->address = uid->email;
- }
if ((!uid->email || !*uid->email) && uid->address && uid->name
&& !strcmp (uid->name, uid->address))
{
@@ -394,9 +388,7 @@ gpgme_key_unref (gpgme_key_t key)
tofu = tofu_next;
}
- if (uid->address && uid->address != uid->email)
- free (uid->address);
-
+ free (uid->address);
free (uid);
uid = next_uid;
}