From patchwork Thu Oct 20 06:33:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhi Li X-Patchwork-Id: 13012660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A353C4332F for ; Thu, 20 Oct 2022 06:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbiJTGd3 (ORCPT ); Thu, 20 Oct 2022 02:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiJTGd0 (ORCPT ); Thu, 20 Oct 2022 02:33:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A96E182C47 for ; Wed, 19 Oct 2022 23:33:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666247602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=fMA1E2Hw3MC8hEokEoRIXv/YOYeMtvblIFcNBzR0+JI=; b=NjhyP+mwfZQeascQcaSIe3alhXTiECSW8qBhhdOe/153YpnGUsXRNqVjSoSz/XumSeSlZe 9pPpTpfQTgV2+UKREGkcqfE4aH5Mvy3ew1VaUhe+NlXPphCpVLA5Slul1b3ekfCA42qtm0 dMJ4EQAXo5VrGRToQQBhRaD1QYnFvV8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-388-Ao9OlWxWNY2wMoEinQ_8dA-1; Thu, 20 Oct 2022 02:33:21 -0400 X-MC-Unique: Ao9OlWxWNY2wMoEinQ_8dA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7C8286E91F for ; Thu, 20 Oct 2022 06:33:20 +0000 (UTC) Received: from localhost (unknown [10.66.60.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0DEE4047A8; Thu, 20 Oct 2022 06:33:18 +0000 (UTC) From: Zhi Li To: linux-nfs@vger.kernel.org Cc: steved@redhat.com, Zhi Li Subject: [PATCH] [nfs/nfs-utils/libtirpc] bindresvport.c: fix a potential resource leakage Date: Thu, 20 Oct 2022 14:33:09 +0800 Message-Id: <20221020063309.3674419-1-yieli@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Close the FILE *fp of load_blacklist() in another return path to avoid potential resource leakage. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2135405 Signed-off-by: Zhi Li --- src/bindresvport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bindresvport.c b/src/bindresvport.c index 5c0ddcf..efeb1cc 100644 --- a/src/bindresvport.c +++ b/src/bindresvport.c @@ -130,6 +130,7 @@ load_blacklist (void) if (list == NULL) { free (buf); + fclose (fp); return; } }