gossip: Duplicate removes can result in null pointers in broadcast

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2018-06-08 18:34:44 +02:00
parent 4429c6e7cd
commit 4e7fc99ae1

View File

@ -33,8 +33,10 @@ struct broadcast_state *new_broadcast_state(tal_t *ctx)
void broadcast_del(struct broadcast_state *bstate, u64 index, const u8 *payload)
{
const struct queued_message *q = uintmap_del(&bstate->broadcasts, index);
assert(q->payload == payload);
broadcast_state_check(bstate, "broadcast_del");
if (q != NULL) {
assert(q->payload == payload);
broadcast_state_check(bstate, "broadcast_del");
}
}
static void destroy_queued_message(struct queued_message *msg,