systemd/0587-tpm2-simplify-call-to-...

29 lines
1.0 KiB
Diff

From cb7d8d4b49a221dac222c417ec0fdd067ba9c21f Mon Sep 17 00:00:00 2001
From: Dan Streetman <ddstreet@ieee.org>
Date: Mon, 21 Aug 2023 17:31:56 -0400
Subject: [PATCH] tpm2: simplify call to asprintf()
(cherry picked from commit 495f2bf57ccd74c5e63040f05430e1148942b2c7)
Related: RHEL-16182
---
src/shared/tpm2-util.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c
index d5dde21b05..02ea6a61f9 100644
--- a/src/shared/tpm2-util.c
+++ b/src/shared/tpm2-util.c
@@ -1754,10 +1754,8 @@ int tpm2_pcr_value_from_string(const char *arg, Tpm2PCRValue *ret_pcr_value) {
* string. This does not check for validity. */
char *tpm2_pcr_value_to_string(const Tpm2PCRValue *pcr_value) {
_cleanup_free_ char *index = NULL, *value = NULL;
- int r;
- r = asprintf(&index, "%u", pcr_value->index);
- if (r < 0)
+ if (asprintf(&index, "%u", pcr_value->index) < 0)
return NULL;
const char *hash = tpm2_hash_alg_to_string(pcr_value->hash);