From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, PDS_RDNS_DYNAMIC_FP,RCVD_IN_DNSWL_MED,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 14AE91F8C6 for ; Tue, 27 Jul 2021 17:44:29 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 454943855005 for ; Tue, 27 Jul 2021 17:44:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 454943855005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627407868; bh=Z8uV9f+V3Pr40SQJ+7/isI6NwMohdd6dRHKxGoOAqsY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=C+sSwjbRVQWm2AafbNPNSIc3Qxb6T4yZ6KzsHx7Huby9dykRI2lujs5DG1/vCNrLp sk+vOrQH4LRenHDeuIsBK2t7uql3uV2/67FcCVZyl/kgRgoiqZRe/SEG8ZVrLnX0Hd XUIL9dEMZGLTSVXFF5TD3F2fpjLWjHFbRKbAR4Fc= Received: from buffalo.birch.relay.mailchannels.net (buffalo.birch.relay.mailchannels.net [23.83.209.24]) by sourceware.org (Postfix) with ESMTPS id F26C73855005 for ; Tue, 27 Jul 2021 17:41:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F26C73855005 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3CA2E342C8F; Tue, 27 Jul 2021 17:41:49 +0000 (UTC) Received: from pdx1-sub0-mail-a35.g.dreamhost.com (100-96-11-33.trex.outbound.svc.cluster.local [100.96.11.33]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id CFAC6342C6E; Tue, 27 Jul 2021 17:41:48 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a35.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.11.33 (trex/6.3.3); Tue, 27 Jul 2021 17:41:49 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Oafish-Illustrious: 0e7746827ca19153_1627407709068_4118601262 X-MC-Loop-Signature: 1627407709068:1260032577 X-MC-Ingress-Time: 1627407709068 Received: from pdx1-sub0-mail-a35.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTP id 16A6986719; Tue, 27 Jul 2021 10:41:48 -0700 (PDT) Received: from rhbox.redhat.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTPSA id 3E8CD86127; Tue, 27 Jul 2021 10:41:45 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a35 To: libc-alpha@sourceware.org Subject: [PATCH 2/5] gconv_parseconfdir: Fix memory leak Date: Tue, 27 Jul 2021 23:11:26 +0530 Message-Id: <20210727174129.3612656-3-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210727174129.3612656-1-siddhesh@sourceware.org> References: <20210727174129.3612656-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Siddhesh Poyarekar via Libc-alpha Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" The allocated `conf` would leak if we have to skip over the file due to the underlying filesystem not supporting dt_type. --- iconv/gconv_parseconfdir.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h index a4153e54c6..2f062689ec 100644 --- a/iconv/gconv_parseconfdir.h +++ b/iconv/gconv_parseconfdir.h @@ -153,12 +153,11 @@ gconv_parseconfdir (const char *dir, size_t dir_len= ) struct stat64 st; if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0) continue; - if (ent->d_type =3D=3D DT_UNKNOWN - && (lstat64 (conf, &st) =3D=3D -1 - || !S_ISREG (st.st_mode))) - continue; =20 - found |=3D read_conf_file (conf, dir, dir_len); + if (ent->d_type !=3D DT_UNKNOWN + || (lstat64 (conf, &st) !=3D -1 && S_ISREG (st.st_mode))) + found |=3D read_conf_file (conf, dir, dir_len); + free (conf); } } --=20 2.31.1