Skip to content

Commit

Permalink
build: fix uninitialized variable error on gcc 7.4.0
Browse files Browse the repository at this point in the history
*best is checked for null before the comparison against the uninitialized
variable ever happens, so this isn't a real issue.

Initialize it to zero so that we don't fail to compile on certain gcc versions.

plugins/pay.c: In function ‘add_shadow_route’:
plugins/pay.c:644:18: error: ‘sample’ may be used uninitialized in this function
   if (!best || v > sample) {
                ~~^~~~~~~~

Signed-off-by: William Casarin <jb55@jb55.com>
  • Loading branch information
jb55 authored and cdecker committed Mar 3, 2019
1 parent e613ae2 commit 9aaf2fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ static struct command_result *add_shadow_route(struct command *cmd,
const jsmntok_t *channels = json_get_member(buf, result, "channels");
const jsmntok_t *chan, *best = NULL;
size_t i;
u64 sample;
u64 sample = 0;
u32 cltv, best_cltv;

json_for_each_arr(i, chan, channels) {
Expand Down

0 comments on commit 9aaf2fe

Please sign in to comment.