Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4656335iob; Sun, 8 May 2022 20:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+vsydEJysDPJ2RGX430HcpKJ3V2wbzetKyYicmFix5hTr0weJKXGjtdXHRMOFA8Q7V4G0 X-Received: by 2002:a63:9553:0:b0:3c6:25b2:9525 with SMTP id t19-20020a639553000000b003c625b29525mr11742384pgn.294.1652068244173; Sun, 08 May 2022 20:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652068244; cv=none; d=google.com; s=arc-20160816; b=MRC20rGGQIlK4bvnJtfmr3ybnU8PYb5Cqf/s7iyX90zvfnil/NLNZVY8vjwYIEuXLL KGbffYU2lm41Qv99T5ligGLjKGrtpY60pYPHXUyhga4f9lvMLxehc0GqThnYxfpnr+pf om6nym5fZ12SsrNU6JUoo/hJVamHln2iRHQc2nE+KOsxqQAW11d7OZZeot2BB/AWom9G pXNquvM1dxIY3AJNQasyHh8POcLYzlVI9e4VjBR/SbLsbM+CltRM1mvWw2ZZlleLbwfp jEhI73HwvuhluDHPuMqVvIiVKxgMSCPLtXwbP+jKP/qTIdfPHcJJIfX7UwLiw06+O7Aw QR7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-filter; bh=qn/7KqvIHhBL8eA/mWcnKwESxKY7t7wuBGf/b3iDjWk=; b=Fz9dfs9P4+g0wEdD+A0cHBpNsvhjE5114j8L4Rf4mMHkJIR4B0JVzu/OSZ02HTiPmp faJte+Kt6VH/WCkrcjmxOvDwzWE5y2c3uNe+hekw+UABTPBOtnPDN9qemba6cGz3CN+F jIzDnA0GS0CbdYTO+MNhdcjt1O1WH9jet7T24YPiB8qjZjK02GQw66oFrLtoXfjNuYiU 6/2X9kpDfutdGQnE52ddbQtXAZQwok2J9xeoOYMq2Xmr5mQXhEjHclq8k9eY3wo0s53Q 5wUIvQCIukeBmGB3VJ0xGddDB9Pk9Kg8izTU3YxxhLFWzwqRqp1zjUqrhu0jm8ewGABK 1Y+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i7-20020a170902cf0700b0015bfd115dcesi10813831plg.455.2022.05.08.20.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 20:50:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C79FCF61C7; Sun, 8 May 2022 20:50:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357356AbiEGRLH (ORCPT + 99 others); Sat, 7 May 2022 13:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446714AbiEGRLC (ORCPT ); Sat, 7 May 2022 13:11:02 -0400 Received: from mxout04.lancloud.ru (mxout04.lancloud.ru [45.84.86.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 762D33BBDF for ; Sat, 7 May 2022 10:07:12 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru EDD12209D24F Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Ildar Kamaletdinov To: CC: Ildar Kamaletdinov Subject: [PATCH BlueZ 1/4] tools: Fix memory leak in hciconfig Date: Sat, 7 May 2022 20:07:00 +0300 Message-ID: <20220507170703.29902-2-i.kamaletdinov@omp.ru> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220507170703.29902-1-i.kamaletdinov@omp.ru> References: <20220507170703.29902-1-i.kamaletdinov@omp.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1910.lancloud.ru (fd00:f066::80) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org printf() was using function that return dynamic allocated memory as a parameter. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. --- tools/hciconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/hciconfig.c b/tools/hciconfig.c index e4d521583..e1b73f22a 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -80,7 +80,11 @@ static void print_pkt_type(struct hci_dev_info *di) static void print_link_policy(struct hci_dev_info *di) { - printf("\tLink policy: %s\n", hci_lptostr(di->link_policy)); + char *str; + + str = hci_lptostr(di->link_policy); + printf("\tLink policy: %s\n", str); + bt_free(str); } static void print_link_mode(struct hci_dev_info *di) -- 2.35.3