Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2021-01-15 23:20:57 -0800
committerAllan McRae <allan@archlinux.org>2021-01-19 12:38:02 +1000
commit5151de301119ef73de12edc98e6c6ff4e2412873 (patch)
tree59a5ef8c4f7f95f68b7a51f53166e93113f24953
parent5d21b2d44c1727e33bd7c71e657501eb013c44d0 (diff)
plug memory leaks in _alpm_key_import
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--lib/libalpm/signing.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 2cbbd103..1f6977a0 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -505,7 +505,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
}
STRDUP(fetch_key.uid, uid, return -1);
- STRDUP(fetch_key.fingerprint, fpr, return -1);
+ STRDUP(fetch_key.fingerprint, fpr, free(fetch_key.uid); return -1);
alpm_question_import_key_t question = {
.type = ALPM_QUESTION_IMPORT_KEY,
@@ -517,6 +517,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
/* Try to import the key from a WKD first */
if(email_from_uid(uid, &email) == 0) {
ret = key_import_wkd(handle, email);
+ free(email);
}
/* If importing from the WKD fails, fall back to keyserver lookup */
@@ -537,6 +538,8 @@ 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;
}