Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4712228iob; Sun, 8 May 2022 22:56:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuT5ys2MbFt1Ng68zltW5wLC0u1G18Waa9JEd3i0oA/9Qom3J6hHbL8i+xfEaw+wrgt+bx X-Received: by 2002:a17:90a:348d:b0:1dd:1779:412f with SMTP id p13-20020a17090a348d00b001dd1779412fmr4195339pjb.18.1652075769518; Sun, 08 May 2022 22:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652075769; cv=none; d=google.com; s=arc-20160816; b=EYfdtWf5FTO7bQ/F21iWQ7AVs69lAqWlhmibUpWtqfxYUh5zDx/+mNHoEuPdNKTu1W jrJwi7mh6UXjDRShuDz78rRHQkWGV+CRSp/sG74XVs0m+Pm3E+STbbnDlm0MDmudqREe ufz8lEzMqeCyeL6rFggOWkLqnbfbno0BP4zPgbO3/Mk9dZf2ck/sD2GuSHuSBhTDG9o6 Geq0hPXBpeXDXE+zxVkedtRx5IDnrLcBa7PbQRXWxuiyWTJjXWpDLo4u5Wj61fAwwU4Z OOXONz4mWXEhvM8vvDMB/OtJzo9lUl48LKqWoNeBIhDS81QIQolWu4RFUMvoNP1lFXiQ YZ6Q== 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=px8zWYUh3xsG4lhOCs091VJu8Kffd9NTvQza11zAlsE=; b=ubXcol56pJy5RT68nxLpyUNXUY3wVpx3E6xpUE4y4x1/2cWb4+U3lFsLElBVwIaGwn Qr6aK4TIm7erCAYhe9sAYnbp5fMs3DvKRFV69ZTLlCY3fseX6cRaN5jXPvrGZHRn1LE8 D5RgjOduqRgHmQTvyfnz8MMINuwX+U5clVaU3/7mXVkGJrb913G9/kdg5ZauRrvKlzGh X86g8jN/hV+d5mqx8YfSOM/wgnK1UnF+PzUUn+DRjxFHimURFxchqe1qT8JdXzpS1Amq 40IEkFKD3KsaLxE8lavZV8G64BsTDXvrTzHxpiXppD0Y7+jSAHbjGPymce8nwvtTyi2J ChCA== 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 v18-20020a634812000000b0039ce7136f94si4050356pga.408.2022.05.08.22.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:56:09 -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 C0C2E10115D; Sun, 8 May 2022 22:51:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347443AbiEGRjH (ORCPT + 99 others); Sat, 7 May 2022 13:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243971AbiEGRjE (ORCPT ); Sat, 7 May 2022 13:39:04 -0400 Received: from mxout01.lancloud.ru (mxout01.lancloud.ru [45.84.86.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEB3322B30 for ; Sat, 7 May 2022 10:35:16 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout01.lancloud.ru 7E31A20D7258 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:35:02 +0300 Message-ID: <20220507173505.31249-2-i.kamaletdinov@omp.ru> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220507173505.31249-1-i.kamaletdinov@omp.ru> References: <20220507173505.31249-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, 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..a1c615bfa 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