diff --git a/0001-lib-clean-up-potential-memory-leak.patch b/0001-lib-clean-up-potential-memory-leak.patch new file mode 100644 index 0000000..0747bb8 --- /dev/null +++ b/0001-lib-clean-up-potential-memory-leak.patch @@ -0,0 +1,31 @@ +From 5b84837757cab93397cfa5830e69d2b7e7ce0e0c Mon Sep 17 00:00:00 2001 +From: Jerry Snitselaar +Date: Wed, 18 Oct 2017 21:46:45 -0700 +Subject: [PATCH] lib: clean up potential memory leak + +In case where sapi_ctx_init fails in sapi_init_from_options, free tcti_ctx. + +Signed-off-by: Jerry Snitselaar +--- + lib/context-util.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/context-util.c b/lib/context-util.c +index 7de22ac..c3034f9 100644 +--- a/lib/context-util.c ++++ b/lib/context-util.c +@@ -205,8 +205,10 @@ sapi_init_from_options (common_opts_t *options) + if (tcti_ctx == NULL) + return NULL; + sapi_ctx = sapi_ctx_init (tcti_ctx); +- if (sapi_ctx == NULL) ++ if (sapi_ctx == NULL) { ++ free (tcti_ctx); + return NULL; ++ } + return sapi_ctx; + } + /* +-- +2.15.0.rc0 + diff --git a/tpm2-tools.spec b/tpm2-tools.spec index e17776a..ba2c48b 100644 --- a/tpm2-tools.spec +++ b/tpm2-tools.spec @@ -1,6 +1,6 @@ Name: tpm2-tools Version: 2.1.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A TPM2.0 testing tool build upon TPM2.0-TSS %global pkg_prefix tpm2.0-tools @@ -13,6 +13,8 @@ Source0: https://github.com/01org/tpm2.0-tools/archive/%{version}.tar.gz#/%{pkg_ Patch0: gcc7-implict-fallthrough-fix.patch # https://github.com/01org/tpm2-tools/commit/5cee30cbc3da Patch1: allow-to-build-with-openssl-1.1.x.patch +# https://github.com/01org/tpm2-tools/pull/567 +Patch2: 0001-lib-clean-up-potential-memory-leak.patch BuildRequires: gcc-c++ BuildRequires: libtool @@ -54,6 +56,9 @@ tpm2-tools is a batch of testing tools for tpm2.0. It is based on tpm2-tss. %{_mandir}/man8/tpm2_*.8.gz %changelog +* Thu Oct 19 2017 Jerry Snitselaar - 2.1.0-7 +- Clean up potential memleak (RHBZ#1503959) + * Thu Oct 05 2017 Javier Martinez Canillas - 2.1.0-6 - Add tpm2-abrmd-devel BuildRequires so tools have abrmd support (RHBZ#1498909)