]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2: simplify call to asprintf()
authorDan Streetman <ddstreet@ieee.org>
Mon, 21 Aug 2023 21:31:56 +0000 (17:31 -0400)
committerDan Streetman <ddstreet@ieee.org>
Thu, 24 Aug 2023 16:33:26 +0000 (12:33 -0400)
src/shared/tpm2-util.c

index 4b3687286468432f4606b787f81726a0a2589051..db51d46bd4605aef65399eda6f44660c86d15984 100644 (file)
@@ -1759,10 +1759,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);