Return-Path: From: Andrei Emeltchenko To: linux-bluetooth@vger.kernel.org Subject: [PATCHv2] shared/gap: Fix memory leak in gap Date: Fri, 19 Dec 2014 14:37:33 +0200 Message-Id: <1418992653-6704-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Andrei Emeltchenko Allocated irk memory was never assigned. --- src/shared/gap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shared/gap.c b/src/shared/gap.c index 19059e8..cc48a02 100644 --- a/src/shared/gap.c +++ b/src/shared/gap.c @@ -276,5 +276,10 @@ bool bt_gap_add_peer_irk(struct bt_gap *gap, uint8_t addr_type, memcpy(irk->addr, addr, 6); memcpy(irk->key, key, 16); + if (!queue_push_tail(gap->irk_list, irk)) { + free(irk); + return false; + } + return true; } -- 2.1.0