From patchwork Fri May 14 13:58:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Grubb X-Patchwork-Id: 12257823 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 568D8C43460 for ; Fri, 14 May 2021 13:57:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3722E6145B for ; Fri, 14 May 2021 13:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232198AbhENN6y (ORCPT ); Fri, 14 May 2021 09:58:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48481 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbhENN6x (ORCPT ); Fri, 14 May 2021 09:58:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621000662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=H0eclNxPJZBfPG3O5+ehiD13CJ+j8Rf0rSP/Wknwajg=; b=baqwAIJ1f6LKKDcFdRjyKfFfe/jOvZs48plNmjnnaDmecSVoju2jAwwyYL++J0irbu/2Tk DmybQaQBjJ0wKFPBFHckiqMuF7AGy7Z+KZw6TRy/bbUPdqPQCRFSQor0ewrll4SCRISiOQ pDAeKd5cuzKD4PzunC3lwei+DLwxj2o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-yEA6ospLPqeFu-lxKntRyw-1; Fri, 14 May 2021 09:57:40 -0400 X-MC-Unique: yEA6ospLPqeFu-lxKntRyw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73F32192377C for ; Fri, 14 May 2021 13:57:39 +0000 (UTC) Received: from ivy-bridge (ovpn-117-226.rdu2.redhat.com [10.10.117.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2E061001B2C for ; Fri, 14 May 2021 13:57:38 +0000 (UTC) Date: Fri, 14 May 2021 09:58:07 -0400 From: Steve Grubb To: linux-bluetooth@vger.kernel.org Subject: [Bluez PATCH 1/6] Fix leak in mesh Message-ID: <20210514095807.62f40ff5@ivy-bridge> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The dir variable needs to be closed before leaving. --- mesh/rpl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mesh/rpl.c b/mesh/rpl.c index ac0f6b6f2..c53c6fbfd 100644 --- a/mesh/rpl.c +++ b/mesh/rpl.c @@ -143,8 +143,10 @@ static void get_entries(const char *iv_path, struct l_queue *rpl_list) return; iv_txt = basename(iv_path); - if (sscanf(iv_txt, "%08x", &iv_index) != 1) + if (sscanf(iv_txt, "%08x", &iv_index) != 1) { + closedir(dir); return; + } memset(seq_txt, 0, sizeof(seq_txt)); From patchwork Fri May 14 13:59:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Grubb X-Patchwork-Id: 12257835 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 012F8C433ED for ; Fri, 14 May 2021 13:59:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D331C61461 for ; Fri, 14 May 2021 13:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232455AbhENOAZ (ORCPT ); Fri, 14 May 2021 10:00:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53469 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbhENOAY (ORCPT ); Fri, 14 May 2021 10:00:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621000752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N4Y3fCMw9Zj84kXaFrDFxx83fftLWa+skQMiN44niN8=; b=QFpxByB5R76aoFuRCvziVLr2U7cEV19hUSfEt+qOWFJ9iHiIii7pWNaDuvZ8FbJN0dGgZp vByvFe7wg2ZRD1tzr0oLtWaIp6zwhVz20SMcN+ifLCxQGEYS75eFpyCRzB0psq+FrFQWby p+IpJRfvq5CcB7sKbA9zIiFmpwbM3AE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-584-M82wqapjP-y9E56qHjO-rQ-1; Fri, 14 May 2021 09:59:10 -0400 X-MC-Unique: M82wqapjP-y9E56qHjO-rQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCBD4107ACC7 for ; Fri, 14 May 2021 13:59:09 +0000 (UTC) Received: from ivy-bridge (ovpn-117-226.rdu2.redhat.com [10.10.117.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7182F19CB1 for ; Fri, 14 May 2021 13:59:09 +0000 (UTC) Date: Fri, 14 May 2021 09:59:38 -0400 From: Steve Grubb To: linux-bluetooth@vger.kernel.org Subject: [Bluez PATCH 3/6] Fix leaks in plugin Message-ID: <20210514095938.19256b85@ivy-bridge> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org g_file_get_contents allocates memory. It needs to be freed on any function exit. --- plugins/hostname.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/hostname.c b/plugins/hostname.c index f7ab9e8bc..1a9513adb 100644 --- a/plugins/hostname.c +++ b/plugins/hostname.c @@ -213,11 +213,10 @@ static void read_dmi_fallback(void) return; type = atoi(contents); + g_free(contents); if (type < 0 || type > 0x1D) return; - g_free(contents); - /* from systemd hostname chassis list */ switch (type) { case 0x3: From patchwork Fri May 14 14:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Grubb X-Patchwork-Id: 12257837 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0FE2C433ED for ; Fri, 14 May 2021 13:59:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97287613E9 for ; Fri, 14 May 2021 13:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbhENOA6 (ORCPT ); Fri, 14 May 2021 10:00:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30185 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbhENOAz (ORCPT ); Fri, 14 May 2021 10:00:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621000784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a0lRKRvDYVida2zbVj/D+aF7YJ5mBOVQjb/Va8b16Ao=; b=OqeZftN064umynbEgSAbDA34xmYbh666G8gQnAuf+YR41yS66imbvZ3b10Hkzg+bCxUu7y 2p2hEQIkeVbTWw0MNsinozchgKpQ6gsG2e4UFvmwtCEiJ/HZuudmLGElIZMpy/Wq3VyONF R3OBvKt1eVAHiAqIPPPAj+0qE0WHOJQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-353-quLEgV6pMfKSVviKEEXclg-1; Fri, 14 May 2021 09:59:42 -0400 X-MC-Unique: quLEgV6pMfKSVviKEEXclg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 840E080006E for ; Fri, 14 May 2021 13:59:41 +0000 (UTC) Received: from ivy-bridge (ovpn-117-226.rdu2.redhat.com [10.10.117.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3106718BB7 for ; Fri, 14 May 2021 13:59:41 +0000 (UTC) Date: Fri, 14 May 2021 10:00:09 -0400 From: Steve Grubb To: linux-bluetooth@vger.kernel.org Subject: [Bluez PATCH 4/6] Fix leaks in profiles Message-ID: <20210514100009.72453e70@ivy-bridge> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org g_new0 allocates memory that must be freed --- profiles/audio/avrcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index c6a342ee3..58d30b24d 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -3508,8 +3508,10 @@ static struct avrcp_player *create_ct_player(struct avrcp *session, path = device_get_path(session->dev); mp = media_player_controller_create(path, id); - if (mp == NULL) + if (mp == NULL) { + g_free(player); return NULL; + } media_player_set_callbacks(mp, &ct_cbs, player); player->user_data = mp; From patchwork Fri May 14 14:00:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Grubb X-Patchwork-Id: 12257839 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81A9FC43462 for ; Fri, 14 May 2021 14:00:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59EE461461 for ; Fri, 14 May 2021 14:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233666AbhENOB2 (ORCPT ); Fri, 14 May 2021 10:01:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22656 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232874AbhENOB2 (ORCPT ); Fri, 14 May 2021 10:01:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621000816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v6osFm+1KnEbk9hihyDBsCIdRPUiSKzamlUA7gQCF2Q=; b=hDyMEEJ2Gg7g+RRLcGukLmx0jSGcbhpSmVDqvEM/xcadKUsWKsyUUrY5LplrCEi2urwpAg LzYoUJlX35eWdKmDN+rkH80nRG4up/BetIfxEkbH2vcjzmJZ5/7RYZiGf1t5uQfCpiNy0H rhORGW+gccj+jRl1M3gTNdXqrxe+BA0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-389-_QATd1pLODuf5XgETqjFxA-1; Fri, 14 May 2021 10:00:14 -0400 X-MC-Unique: _QATd1pLODuf5XgETqjFxA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1280D107ACE6 for ; Fri, 14 May 2021 14:00:14 +0000 (UTC) Received: from ivy-bridge (ovpn-117-226.rdu2.redhat.com [10.10.117.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id B745E5C3E6 for ; Fri, 14 May 2021 14:00:13 +0000 (UTC) Date: Fri, 14 May 2021 10:00:42 -0400 From: Steve Grubb To: linux-bluetooth@vger.kernel.org Subject: [Bluez PATCH 5/6] Fix leaks in src Message-ID: <20210514100042.4fdd13a5@ivy-bridge> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org g_key_file_get_string allocates memory that must be freed. asprintf allocates memory that must be freed. --- src/main.c | 1 + src/shared/shell.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main.c b/src/main.c index c32bda7d4..94141b1e4 100644 --- a/src/main.c +++ b/src/main.c @@ -795,6 +795,7 @@ static void parse_config(GKeyFile *config) parse_br_config(config); parse_le_config(config); + g_free(str); } static void init_defaults(void) diff --git a/src/shared/shell.c b/src/shared/shell.c index c0de1640d..eed300631 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -611,6 +611,7 @@ void bt_shell_prompt_input(const char *label, const char *msg, prompt->user_data = user_data; queue_push_tail(data.prompts, prompt); + free(str); return; } From patchwork Fri May 14 14:01:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Grubb X-Patchwork-Id: 12257841 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33882C433ED for ; Fri, 14 May 2021 14:00:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 104FA61460 for ; Fri, 14 May 2021 14:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbhENOCF (ORCPT ); Fri, 14 May 2021 10:02:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38881 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232467AbhENOCE (ORCPT ); Fri, 14 May 2021 10:02:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621000852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2lWRxNCJUBOEXLUFkEZYi48NEyf2fGZlzRhezQGxN1U=; b=WRxvdDbWiNTdQKWugTz4oHgXmL9xNY6XQAKTvUOHHKnzx530wsEyDonKTvvG7d3jGzBEeQ kAQWNMLCX+UI2Ug5TRP+aNtiGABFNHlkQAD18SaIlbOgjxvHkUPjmZaR/RTNJFqFuJ7VBD jTJNYiq6hktT1egTz8egMm4THX+MsUM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-O_xATaSUMtexZfiv1AIXcQ-1; Fri, 14 May 2021 10:00:50 -0400 X-MC-Unique: O_xATaSUMtexZfiv1AIXcQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EB5A8027E2 for ; Fri, 14 May 2021 14:00:49 +0000 (UTC) Received: from ivy-bridge (ovpn-117-226.rdu2.redhat.com [10.10.117.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDE3B19C79 for ; Fri, 14 May 2021 14:00:48 +0000 (UTC) Date: Fri, 14 May 2021 10:01:17 -0400 From: Steve Grubb To: linux-bluetooth@vger.kernel.org Subject: [Bluez PATCH 6/6] Fix leaks in tools Message-ID: <20210514100117.3ea5f337@ivy-bridge> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org req is allocated memory that must be freed. It appears all other error paths got fail which handles this. g_new0 allocates memory to data which must be freed. g_malloc0 allocates memory to comp which must be freed. --- tools/mesh-cfgclient.c | 2 +- tools/mesh-gatt/gatt.c | 1 + tools/mesh-gatt/node.c | 12 +++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c index 1eeed2a1a..49069674f 100644 --- a/tools/mesh-cfgclient.c +++ b/tools/mesh-cfgclient.c @@ -914,7 +914,7 @@ static void cmd_import_node(int argc, char *argv[]) /* Number of elements */ if (sscanf(argv[4], "%u", &req->arg3) != 1) - return; + goto fail; /* DevKey */ req->data2 = l_util_from_hexstring(argv[5], &sz); diff --git a/tools/mesh-gatt/gatt.c b/tools/mesh-gatt/gatt.c index b99234f91..c8a8123fb 100644 --- a/tools/mesh-gatt/gatt.c +++ b/tools/mesh-gatt/gatt.c @@ -525,6 +525,7 @@ bool mesh_gatt_notify(GDBusProxy *proxy, bool enable, GDBusReturnFunction cb, notify_io_destroy(); if (cb) cb(NULL, user_data); + g_free(data); return true; } else { method = "StopNotify"; diff --git a/tools/mesh-gatt/node.c b/tools/mesh-gatt/node.c index 6afda3387..356e1cd1a 100644 --- a/tools/mesh-gatt/node.c +++ b/tools/mesh-gatt/node.c @@ -396,8 +396,10 @@ bool node_parse_composition(struct mesh_node *node, uint8_t *data, uint16_t len) uint16_t vendor_id; struct mesh_element *ele; ele = g_malloc0(sizeof(struct mesh_element)); - if (!ele) + if (!ele) { + g_free(comp); return false; + } ele->index = i; ele->loc = get_le16(data); @@ -412,8 +414,10 @@ bool node_parse_composition(struct mesh_node *node, uint8_t *data, uint16_t len) mod_id = get_le16(data); /* initialize uppper 16 bits to 0xffff for SIG models */ mod_id |= 0xffff0000; - if (!node_set_model(node, ele->index, mod_id)) + if (!node_set_model(node, ele->index, mod_id)) { + g_free(comp); return false; + } data += 2; len -= 2; } @@ -421,8 +425,10 @@ bool node_parse_composition(struct mesh_node *node, uint8_t *data, uint16_t len) mod_id = get_le16(data + 2); vendor_id = get_le16(data); mod_id |= (vendor_id << 16); - if (!node_set_model(node, ele->index, mod_id)) + if (!node_set_model(node, ele->index, mod_id)) { + g_free(comp); return false; + } data += 4; len -= 4; }