Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3434106ioo; Mon, 30 May 2022 01:53:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMpYqYWYEbxYV/P9BU+8LDKVRhs0XMTfU60ADpcyQdeudJRxzO7mHe0zmW/OXdXkrIup8U X-Received: by 2002:a17:907:6287:b0:6e1:6ac:c769 with SMTP id nd7-20020a170907628700b006e106acc769mr48148174ejc.388.1653900827481; Mon, 30 May 2022 01:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653900827; cv=none; d=google.com; s=arc-20160816; b=yLC+1L5lBg3PgM9VBkhaP4VspoRW2xOKiY/koRhRa7/A+ATRT67+/xzXtTrYSjqRdX Zbd9cuHAlOzk5DEBeSvJqdSyWgPTav8cqEsvaswgs+ITW4zcf0EDk2Q/dmfIRZbGj5M1 F73pB74ZXHE940ubg42IbP90nSo6HDlgMb1FxMtPbP0en+jV6ZT3Bj8r8q43HdN2HxYZ BKonXQ+OImmoAoodYzBNsLSoTgnOBuk0gL6/dxJu89CvJbWn7YgjsFCvnj23WuLWSEwI 6DIp9XTioFwPS7Ua4Drqb2FzrpNy8UbXFc6i5In7a8J3yMSYMhzwTWARcW1FsnoqxYXG PIbA== 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; bh=3fV+IWIg33Xr+KFv0y+t375zo7gfZhgjbUblh7/F7yo=; b=srl74W/GLdzSph7v1xcl3Shz+crqANYV8MJ5Mq6fqIgKLWyXGcUoMBSjd/lyRnHy3t gtfIPDU6RIFdLaUERQO7PYTQy6nWuKfqnzwvNpGrh5ajPlQudVYEsMuZRoTQMGA78yyX 04WCFdv39EEODyIgKYIWUBwJMPbg+pR6wQkjCiHCGeZ5OzMvrsSTfBymyn/A3c42v5pS l4FEIuRFp+Yj3ylwjWNwxQHIkdLxUCaYRh8a2TKgMP9JoLgU1Qb5OLWoHD98BAEeaS2B Od5WsNp/EdDClZTPWt9zFSnvklHOtp37Lf2UE5wfS1TLpv+9+nRSvN+ygDELayme/tCK JLuw== 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n11-20020a056402060b00b0042ddac8f86bsi51000edv.278.2022.05.30.01.53.20; Mon, 30 May 2022 01:53:47 -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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233221AbiE3IMu (ORCPT + 99 others); Mon, 30 May 2022 04:12:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233218AbiE3IMq (ORCPT ); Mon, 30 May 2022 04:12:46 -0400 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 70EB23B572 for ; Mon, 30 May 2022 01:12:41 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-544-DpkBOrIfMneHj-fHFqUQiA-1; Mon, 30 May 2022 04:12:39 -0400 X-MC-Unique: DpkBOrIfMneHj-fHFqUQiA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C350C1C0515D; Mon, 30 May 2022 08:12:38 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.64.242.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FDD91415100; Mon, 30 May 2022 08:12:36 +0000 (UTC) From: Gopal Tiwari To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, gtiwari@redhat.com Subject: [Bluez 07/13] Fixing leaked_handle in l2cap-tester.c Date: Mon, 30 May 2022 13:42:03 +0530 Message-Id: <20220530081209.560465-8-gopalkrishna.tiwari@gmail.com> In-Reply-To: <20220530081209.560465-1-gopalkrishna.tiwari@gmail.com> References: <20220530081209.560465-1-gopalkrishna.tiwari@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE 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 From: Gopal Tiwari While performing static tool analysis using coverity found following reports for resouse leak bluez-5.64/tools/l2cap-tester.c:1712: leaked_handle: Handle variable "new_sk" going out of scope leaks the handle. Signed-off-by: Gopal Tiwari --- tools/l2cap-tester.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c index d78b1e29c..3f0464013 100644 --- a/tools/l2cap-tester.c +++ b/tools/l2cap-tester.c @@ -1709,6 +1709,7 @@ static gboolean l2cap_listen_cb(GIOChannel *io, GIOCondition cond, if (!check_mtu(data, new_sk)) { tester_test_failed(); + close(new_sk); return FALSE; } -- 2.26.2