Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4028009iob; Sun, 8 May 2022 00:43:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+p0Otx5DFTRpIL4R9tiaeguDrygKme82SqJfpd2UBrwcjeJ+H5G0HtdBc8WPV0B5iTcJH X-Received: by 2002:a17:906:301a:b0:6f3:fdd3:4d1c with SMTP id 26-20020a170906301a00b006f3fdd34d1cmr10052436ejz.235.1651995809057; Sun, 08 May 2022 00:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651995809; cv=none; d=google.com; s=arc-20160816; b=rql4bSDIcNEJXYphcVfAsXFlHIPXdHWawhv3cPDfPXPSS9hwoOsoT6dqF43sYJ6ppb mEDdZ95pcd7zpIKTDl18JdOGy6rLwsdkvB6zeaJjoRIPZyy/GHLvjhbdyQGS5wv4J2Er uCkRrVtoz95nGoyq3XIvOcMxJDhdESuulKu0gSTcw2a/tRSPwow+rtV0UsaG3DI9nHEw Z+fl/arN+i6eyncsHcjvctVIumtjbRffaapoe82cv8NskhLJRl1gL0JFwHQlS2Za6Xpp c5HojUxsvQ6AZ+TyYrCZ8zbkDoqLCWJL8EErOj+I+idIsUorZmDrB9kHoCFuscmlSswZ ie3A== 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=ka5tnfCUeNJ+L41iqyelVbEiOqnauyiqFa8Qi3hzOnY=; b=mRcGMGeHJrcjIPhRuBT6tJTN1F+/WYJbYIQ4N+1ctEoW+HxRfmhphroAUmcZ/mU5mx +yD51qI599og2oooHE8zsXugTiIN/lbq8+9EhcqiZc7bjI2wYl2OFBYsbui9hyXDxxNq okxfsESZP+bzbIDvsdbTcnx0XiYPy0LQfKtn2E+c7Kdatb2Te088j6hXwgnFq6aePs14 F+FGQdG+DWdPngdOYlZBYUDIPYwC39TfpThPZJhJnAVTbghSNYO8lGDY3oW/mNXp/oTN S11bmGoxsK2GUEIX7fVCuHL6cZpizOR20LQIhJcaQoZwIdmF+nxowM6N4X8tDZAI7l8c uZyg== 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:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a50ec93000000b00425ba3433c7si8529976edr.258.2022.05.08.00.42.40; Sun, 08 May 2022 00:43:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354390AbiEGPQq (ORCPT + 99 others); Sat, 7 May 2022 11:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241614AbiEGPQq (ORCPT ); Sat, 7 May 2022 11:16:46 -0400 Received: from mxout01.lancloud.ru (mxout01.lancloud.ru [45.84.86.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85B312D1FE for ; Sat, 7 May 2022 08:12:58 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 8685020CFFC6 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 18:06:54 +0300 Message-ID: <20220507150657.28240-2-i.kamaletdinov@omp.ru> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220507150657.28240-1-i.kamaletdinov@omp.ru> References: <20220507150657.28240-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: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1910.lancloud.ru (fd00:f066::80) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/hciconfig.c b/tools/hciconfig.c index e4d521583..2619285d5 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -80,7 +80,10 @@ 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