Commit 542910d6 authored by Morgan Adamiec's avatar Morgan Adamiec Committed by Allan McRae
Browse files

libalpm: fix double free when importing key

Comit 5151de30

 tried to fix leaking memory when importing a key. However
key_search_keyserver() writes to the key passed in, making the original
uid and fingerprint unreachable, causing the new uid and fingerprint to
double free.

Fixes FS#71107
Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent 23810976
Pipeline #8876 passed with stage
in 1 minute and 59 seconds
......@@ -513,6 +513,10 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
.key = &fetch_key
};
QUESTION(handle, &question);
free(fetch_key.uid);
free(fetch_key.fingerprint);
if(question.import) {
/* Try to import the key from a WKD first */
if(email_from_uid(uid, &email) == 0) {
......@@ -538,9 +542,6 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
}
}
gpgme_key_unref(fetch_key.data);
free(fetch_key.uid);
free(fetch_key.fingerprint);
return ret;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment