From 1e5f9d163adfada1a83fb9b34e8435236d0e8a16 Mon Sep 17 00:00:00 2001 From: "Jamie C. Driver" Date: Tue, 30 Apr 2024 10:28:49 +0100 Subject: [PATCH] qrmode: fix potential memory leak in psbt failure case --- main/qrmode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/qrmode.c b/main/qrmode.c index e5db9bc5..e49b25fc 100644 --- a/main/qrmode.c +++ b/main/qrmode.c @@ -1082,12 +1082,13 @@ static bool parse_sign_display_bcur_psbt_qr(const uint8_t* cbor, const size_t cb size_t cbor_signed_len = 0; if (!bcur_build_cbor_crypto_psbt(psbt, &cbor_signed, &cbor_signed_len)) { JADE_LOGW("Failed to build bcur/cbor for psbt"); - return false; + goto cleanup; } // Now display bcur QR const char* message[] = { "Scan with", "wallet", "app" }; display_bcur_qr(message, 3, BCUR_TYPE_CRYPTO_PSBT, cbor_signed, cbor_signed_len, "blkstrm.com/psbt"); + ret = true; cleanup: JADE_WALLY_VERIFY(wally_psbt_free(psbt));