From 1510ea5717c9a9aab931fd01a1930fed40f9f1a0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 1 Aug 2019 11:04:05 +0930 Subject: [PATCH] wallet/walletrpc.c: fix uninitialized warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The withdraw_tx function shouldn't use it, but GCC is right it's uninitialized: wallet/walletrpc.c: In function ‘json_prepare_tx’: wallet/walletrpc.c:202:15: error: ‘changekey’ may be used uninitialized in this function [-Werror=maybe-uninitialized] Signed-off-by: Rusty Russell --- wallet/walletrpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index c89d28096..efe3f37e0 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -198,7 +198,8 @@ static struct command_result *json_prepare_tx(struct command *cmd, if (!bip32_pubkey(cmd->ld->wallet->bip32_base, changekey, (*utx)->wtx->change_key_index)) return command_fail(cmd, LIGHTNINGD, "Keys generation failure"); - } + } else + changekey = NULL; (*utx)->tx = withdraw_tx(*utx, get_chainparams(cmd->ld), (*utx)->wtx->utxos, (*utx)->destination, (*utx)->wtx->amount,