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.
This commit is contained in:
parent
a28d31fdb6
commit
b5075030be
10
src/key.c
10
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user