Fix memory leak in credman

Resolves: RHEL-35253
This commit is contained in:
Dmitry Belyavskiy 2024-10-23 15:35:57 +02:00
parent d15ba86b88
commit 192ba81383
2 changed files with 42 additions and 1 deletions

35
01-fix-credman-leak.patch Normal file
View File

@ -0,0 +1,35 @@
diff --git a/tools/credman.c b/tools/credman.c
index a0a3149d..9f6072f7 100644
--- a/tools/credman.c
+++ b/tools/credman.c
@@ -119,6 +119,7 @@ print_rk(const fido_credman_rk_t *rk, size_t idx)
char *user_id = NULL;
const char *type;
const char *prot;
+ int r = -1;
if ((cred = fido_credman_rk(rk, idx)) == NULL) {
warnx("fido_credman_rk");
@@ -128,7 +129,7 @@ print_rk(const fido_credman_rk_t *rk, size_t idx)
&id) < 0 || base64_encode(fido_cred_user_id_ptr(cred),
fido_cred_user_id_len(cred), &user_id) < 0) {
warnx("output error");
- return -1;
+ goto out;
}
type = cose_string(fido_cred_type(cred));
@@ -137,10 +138,12 @@ print_rk(const fido_credman_rk_t *rk, size_t idx)
printf("%02u: %s %s %s %s %s\n", (unsigned)idx, id,
fido_cred_display_name(cred), user_id, type, prot);
+ r = 0;
+out:
free(user_id);
free(id);
- return 0;
+ return r;
}
int

View File

@ -1,7 +1,7 @@
Name: libfido2
Version: 1.14.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: FIDO2 library
License: BSD-2-Clause
@ -10,6 +10,8 @@ Source0: https://developers.yubico.com/%{name}/Releases/%{name}-%{version
Source1: https://developers.yubico.com/%{name}/Releases/%{name}-%{version}.tar.gz.sig
Source2: yubico-release-gpgkeys.asc
Patch01: 01-fix-credman-leak.patch
BuildRequires: gnupg2
BuildRequires: cmake
BuildRequires: make
@ -97,6 +99,10 @@ find %{buildroot} -type f -name "*.a" -delete -print
%changelog
* Wed Oct 23 2024 Dmitry Belyavskiy <dbelyavs@redhat.com> - 1.14.0-6
- Fix memory leak in credman
Resolves: RHEL-35253
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.14.0-5
- Bump release for June 2024 mass rebuild