From unknown Tue Jun 17 01:44:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 25 Mar 2021 10:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47384 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 47384@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16166699214901 (code B ref -1); Thu, 25 Mar 2021 10:59:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 Mar 2021 10:58:41 +0000 Received: from localhost ([127.0.0.1]:37278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPNhJ-0001Gz-Ij for submit@debbugs.gnu.org; Thu, 25 Mar 2021 06:58:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:48048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPNhI-0001Gp-5a for submit@debbugs.gnu.org; Thu, 25 Mar 2021 06:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPNhH-00018a-Qp for bug-coreutils@gnu.org; Thu, 25 Mar 2021 06:58:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPNhF-0004ZF-SC for bug-coreutils@gnu.org; Thu, 25 Mar 2021 06:58:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616669916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=moqvSYJz5w/3A2GRyV6UtyLuinuQ5Lw3LUESSdlYPsM=; b=jOyPwPy39RfDiFXoMBtbwnM7+4PXxmI7TMknJiUOs62/geOq/PG2aMbu+6pqcaKyNB2Eg5 LKqC3fiOxA2IgIEIoW+PzbX3oB4cZ3szSFXxWgZuCmofXB8YiGsOOOAlTUUe7Xqzkz+JNM FjoJ3ic51cn8ml8+xNPNl1WnZL1ghh4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-0ocFO0S1MGOYRQyKRnD0JQ-1; Thu, 25 Mar 2021 06:58:19 -0400 X-MC-Unique: 0ocFO0S1MGOYRQyKRnD0JQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B48D719251DD for ; Thu, 25 Mar 2021 10:57:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0665F17258; Thu, 25 Mar 2021 10:57:57 +0000 (UTC) From: Kamil Dudka Date: Thu, 25 Mar 2021 11:57:55 +0100 Message-Id: <20210325105756.145689-1-kdudka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=63.128.21.124; envelope-from=kdudka@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * src/hostname.c (main): Free allocated memory when compiled with -Dlint. --- src/hostname.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hostname.c b/src/hostname.c index 7d13575d4e9..8ec9aad4d34 100644 --- a/src/hostname.c +++ b/src/hostname.c @@ -104,6 +104,9 @@ main (int argc, char **argv) if (hostname == NULL) die (EXIT_FAILURE, errno, _("cannot determine hostname")); printf ("%s\n", hostname); +#ifdef lint + free(hostname); +#endif } if (optind + 1 < argc) -- 2.26.3 From unknown Tue Jun 17 01:44:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 25 Mar 2021 15:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47384 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Kamil Dudka Cc: 47384@debbugs.gnu.org Received: via spool by 47384-submit@debbugs.gnu.org id=B47384.161668778713124 (code B ref 47384); Thu, 25 Mar 2021 15:57:02 +0000 Received: (at 47384) by debbugs.gnu.org; 25 Mar 2021 15:56:27 +0000 Received: from localhost ([127.0.0.1]:39329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSLS-0003Pc-Up for submit@debbugs.gnu.org; Thu, 25 Mar 2021 11:56:27 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSLP-0003PL-7h for 47384@debbugs.gnu.org; Thu, 25 Mar 2021 11:56:25 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 076601600BC; Thu, 25 Mar 2021 08:56:17 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 6pFSyQS4vRci; Thu, 25 Mar 2021 08:56:16 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5E228160118; Thu, 25 Mar 2021 08:56:16 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id oORGF-d1_FVO; Thu, 25 Mar 2021 08:56:16 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 197D11600BC; Thu, 25 Mar 2021 08:56:16 -0700 (PDT) References: <20210325105756.145689-1-kdudka@redhat.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <349ab1a7-b711-f03a-0738-f4fcd27ee38b@cs.ucla.edu> Date: Thu, 25 Mar 2021 08:56:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210325105756.145689-1-kdudka@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On 3/25/21 3:57 AM, Kamil Dudka wrote: > +#ifdef lint > + free(hostname); > +#endif Let's not do this one. The program is about to exit so there's no need=20 to free, and any static-checking tool that complains about a missing=20 'free' here is issuing a false alarm. On this particular issue it's=20 better to fix the tools than to clutter upb source code to pacify them. From unknown Tue Jun 17 01:44:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 25 Mar 2021 16:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47384 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Paul Eggert Cc: 47384@debbugs.gnu.org X-Debbugs-Original-Cc: 47384@debbugs.gnu.org, bug-coreutils@gnu.org Received: via spool by 47384-submit@debbugs.gnu.org id=B47384.161668853814541 (code B ref 47384); Thu, 25 Mar 2021 16:09:01 +0000 Received: (at 47384) by debbugs.gnu.org; 25 Mar 2021 16:08:58 +0000 Received: from localhost ([127.0.0.1]:39368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSXa-0003mT-IQ for submit@debbugs.gnu.org; Thu, 25 Mar 2021 12:08:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSXY-0003mK-6K for 47384@debbugs.gnu.org; Thu, 25 Mar 2021 12:08:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616688536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8F6e7xXoZRFf1SC8wSXnMLOFukKuPPM590cXSgLXj8o=; b=jRgKjq875vtKEMaGI4KECuxC9YV1JJClnH1+hz/QsRAQrSSSoco3fF7lNeWW0BuLNCHjSN aKflblYiNQ7dBtaEqJUcsTVQsYHoSTdu0XvMMlMdtyHNJj5nbIrTo7YkLNdG9aeQAJWSrQ rthsnG7AGemPgdGd8GBluV5osVtPXWE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-hHMm0v92NJegYRU0E59K8A-1; Thu, 25 Mar 2021 12:08:52 -0400 X-MC-Unique: hHMm0v92NJegYRU0E59K8A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF222801FD8; Thu, 25 Mar 2021 16:08:51 +0000 (UTC) Received: from nbkamil.localnet (unknown [10.40.192.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 220265D9CA; Thu, 25 Mar 2021 16:08:50 +0000 (UTC) From: Kamil Dudka Date: Thu, 25 Mar 2021 17:08:50 +0100 Message-ID: <43697006.fMDQidcC6G@nbkamil> In-Reply-To: <349ab1a7-b711-f03a-0738-f4fcd27ee38b@cs.ucla.edu> References: <20210325105756.145689-1-kdudka@redhat.com> <349ab1a7-b711-f03a-0738-f4fcd27ee38b@cs.ucla.edu> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Thursday, March 25, 2021 4:56:15 PM CET Paul Eggert wrote: > On 3/25/21 3:57 AM, Kamil Dudka wrote: > > +#ifdef lint > > + free(hostname); > > +#endif > > Let's not do this one. The program is about to exit so there's no need > to free, and any static-checking tool that complains about a missing > 'free' here is issuing a false alarm. On this particular issue it's > better to fix the tools than to clutter upb source code to pacify them. Wasn't that exactly what -Dlint was for when we discussed it the last time? I am totally lost in your reasoning again. But thank you for having a look. Kamil From unknown Tue Jun 17 01:44:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 25 Mar 2021 16:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47384 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Kamil Dudka Cc: 47384@debbugs.gnu.org X-Debbugs-Original-Cc: 47384@debbugs.gnu.org, bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161668859814687 (code B ref -1); Thu, 25 Mar 2021 16:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 Mar 2021 16:09:58 +0000 Received: from localhost ([127.0.0.1]:39381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSYX-0003op-Qx for submit@debbugs.gnu.org; Thu, 25 Mar 2021 12:09:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:60968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSYT-0003oa-S2 for submit@debbugs.gnu.org; Thu, 25 Mar 2021 12:09:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPSYS-0006RU-S4 for bug-coreutils@gnu.org; Thu, 25 Mar 2021 12:09:53 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:55280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPSYQ-0007tP-1o for bug-coreutils@gnu.org; Thu, 25 Mar 2021 12:09:52 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EE2AA160119; Thu, 25 Mar 2021 09:09:46 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id dnlzmFwF13id; Thu, 25 Mar 2021 09:09:46 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 517A7160118; Thu, 25 Mar 2021 09:09:46 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id fjcf8OBnQFML; Thu, 25 Mar 2021 09:09:46 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 28D4E1600BC; Thu, 25 Mar 2021 09:09:46 -0700 (PDT) References: <20210325105756.145689-1-kdudka@redhat.com> <349ab1a7-b711-f03a-0738-f4fcd27ee38b@cs.ucla.edu> <43697006.fMDQidcC6G@nbkamil> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Thu, 25 Mar 2021 09:09:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <43697006.fMDQidcC6G@nbkamil> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 3/25/21 9:08 AM, Kamil Dudka wrote: > Wasn't that exactly what -Dlint was for when we discussed it the last time? Sorry, don't recall the last time. This is a borderline area, admittedly. From unknown Tue Jun 17 01:44:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint Resent-From: Kamil Dudka Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 25 Mar 2021 16:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47384 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Paul Eggert Cc: 47384@debbugs.gnu.org X-Debbugs-Original-Cc: 47384@debbugs.gnu.org, bug-coreutils@gnu.org Received: via spool by 47384-submit@debbugs.gnu.org id=B47384.161669003917091 (code B ref 47384); Thu, 25 Mar 2021 16:34:01 +0000 Received: (at 47384) by debbugs.gnu.org; 25 Mar 2021 16:33:59 +0000 Received: from localhost ([127.0.0.1]:39431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSvn-0004Ra-IC for submit@debbugs.gnu.org; Thu, 25 Mar 2021 12:33:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPSvl-0004RT-PT for 47384@debbugs.gnu.org; Thu, 25 Mar 2021 12:33:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616690037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rwhTYiFgRA0klK/FSvZGh+uduUQa3LPE0krHRDeORtQ=; b=czlscOdWO6LrfNiKF8R4RwE4fOZ2zv2Yi2lSTyYSKLNAUVFFa/VdZfOVL3ueend7y9B7D5 gi9ZdYruG6v98E0nP9SxV9zN83Pjwd04mg+4hd63d4Bv0YSNjR6ZH0ji/QblDupcoWMYdN csm9RdZtt6q5M4UnMnOkc1AONlnU6Kc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-uneyVJ_cOsKUSSUg6ukwxA-1; Thu, 25 Mar 2021 12:33:53 -0400 X-MC-Unique: uneyVJ_cOsKUSSUg6ukwxA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B75C7108BD07; Thu, 25 Mar 2021 16:33:52 +0000 (UTC) Received: from nbkamil.localnet (unknown [10.40.192.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5EF21007625; Thu, 25 Mar 2021 16:33:51 +0000 (UTC) From: Kamil Dudka Date: Thu, 25 Mar 2021 17:33:50 +0100 Message-ID: <5151416.Sb9uPGUboI@nbkamil> In-Reply-To: References: <20210325105756.145689-1-kdudka@redhat.com> <43697006.fMDQidcC6G@nbkamil> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Thursday, March 25, 2021 5:09:44 PM CET Paul Eggert wrote: > On 3/25/21 9:08 AM, Kamil Dudka wrote: > > Wasn't that exactly what -Dlint was for when we discussed it the last > > time? > > Sorry, don't recall the last time. I meant this thread on bug-gnulib ML: https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00114.html > This is a borderline area, admittedly. How does it differ from the following change, which you did not block? https://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.24-21-ga4b640549df Kamil From unknown Tue Jun 17 01:44:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 25 Mar 2021 18:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47384 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: Kamil Dudka Cc: 47384@debbugs.gnu.org X-Debbugs-Original-Cc: 47384@debbugs.gnu.org, bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161669621927474 (code B ref -1); Thu, 25 Mar 2021 18:17:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Mar 2021 18:16:59 +0000 Received: from localhost ([127.0.0.1]:39538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPUXT-00078y-8a for submit@debbugs.gnu.org; Thu, 25 Mar 2021 14:16:59 -0400 Received: from lists.gnu.org ([209.51.188.17]:39662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPUXO-00078h-Po for submit@debbugs.gnu.org; Thu, 25 Mar 2021 14:16:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPUXO-0001qy-G1 for bug-coreutils@gnu.org; Thu, 25 Mar 2021 14:16:54 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPUXL-00015C-DW for bug-coreutils@gnu.org; Thu, 25 Mar 2021 14:16:53 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 271CD1600BC; Thu, 25 Mar 2021 11:16:48 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id nF6UENLn10CP; Thu, 25 Mar 2021 11:16:47 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 42CD51600ED; Thu, 25 Mar 2021 11:16:47 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XtMus0AKha7c; Thu, 25 Mar 2021 11:16:47 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D455F1600BC; Thu, 25 Mar 2021 11:16:46 -0700 (PDT) References: <20210325105756.145689-1-kdudka@redhat.com> <43697006.fMDQidcC6G@nbkamil> <5151416.Sb9uPGUboI@nbkamil> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Thu, 25 Mar 2021 11:16:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <5151416.Sb9uPGUboI@nbkamil> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 3/25/21 9:33 AM, Kamil Dudka wrote: > How does it differ from the following change, which you did not block? Thanks for reminding me of the earlier exchange. On second thought I guess it's OK, though I'd prefer it to use IF_LINT (as in the earlier change), as that makes it cleaner since it's just one line of useless code, not three. From unknown Tue Jun 17 01:44:17 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Kamil Dudka Subject: bug#47384: closed (Re: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint) Message-ID: References: <3d31ec68-9fef-5359-bf3b-3446a5772a35@cs.ucla.edu> <20210325105756.145689-1-kdudka@redhat.com> X-Gnu-PR-Message: they-closed 47384 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: patch Reply-To: 47384@debbugs.gnu.org Date: Thu, 25 Mar 2021 18:23:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1616696582-28091-1" This is a multi-part message in MIME format... ------------=_1616696582-28091-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 47384@debbugs.gnu.org. --=20 47384: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D47384 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1616696582-28091-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 47384-done) by debbugs.gnu.org; 25 Mar 2021 18:22:44 +0000 Received: from localhost ([127.0.0.1]:39552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPUd1-0007IJ-Vu for submit@debbugs.gnu.org; Thu, 25 Mar 2021 14:22:44 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPUcy-0007I4-R3 for 47384-done@debbugs.gnu.org; Thu, 25 Mar 2021 14:22:42 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C65FB1600BC; Thu, 25 Mar 2021 11:22:34 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Xurd-Dfn0qvL; Thu, 25 Mar 2021 11:22:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 17E131600ED; Thu, 25 Mar 2021 11:22:34 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 96rn__z_pli1; Thu, 25 Mar 2021 11:22:33 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E22D91600BC; Thu, 25 Mar 2021 11:22:33 -0700 (PDT) Subject: Re: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint From: Paul Eggert To: Kamil Dudka References: <20210325105756.145689-1-kdudka@redhat.com> <43697006.fMDQidcC6G@nbkamil> <5151416.Sb9uPGUboI@nbkamil> Organization: UCLA Computer Science Department Message-ID: <3d31ec68-9fef-5359-bf3b-3446a5772a35@cs.ucla.edu> Date: Thu, 25 Mar 2021 11:22:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------BEC151E5EC3699924877365E" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47384-done Cc: 47384-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------BEC151E5EC3699924877365E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 3/25/21 11:16 AM, Paul Eggert wrote: > I'd prefer it to use IF_LINT (as in the earlier > change), as that makes it cleaner since it's just one line of useless > code, not three. Installed as attached, and closing the bug report. Thanks again. --------------BEC151E5EC3699924877365E Content-Type: text/x-patch; charset=UTF-8; name="0001-hostname-pacify-valgrind.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-hostname-pacify-valgrind.patch" >From d3749c46056ddeb1314f35b1644f52179d7a3502 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 25 Mar 2021 11:20:18 -0700 Subject: [PATCH] hostname: pacify valgrind * src/hostname.c (main) [IF_LINT]: Free hostname (Bug#47384). --- src/hostname.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hostname.c b/src/hostname.c index 008682f39..94b070582 100644 --- a/src/hostname.c +++ b/src/hostname.c @@ -104,6 +104,7 @@ main (int argc, char **argv) if (hostname == NULL) die (EXIT_FAILURE, errno, _("cannot determine hostname")); puts (hostname); + IF_LINT (free (hostname)); } if (optind + 1 < argc) -- 2.27.0 --------------BEC151E5EC3699924877365E-- ------------=_1616696582-28091-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Mar 2021 10:58:41 +0000 Received: from localhost ([127.0.0.1]:37278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPNhJ-0001Gz-Ij for submit@debbugs.gnu.org; Thu, 25 Mar 2021 06:58:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:48048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPNhI-0001Gp-5a for submit@debbugs.gnu.org; Thu, 25 Mar 2021 06:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPNhH-00018a-Qp for bug-coreutils@gnu.org; Thu, 25 Mar 2021 06:58:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPNhF-0004ZF-SC for bug-coreutils@gnu.org; Thu, 25 Mar 2021 06:58:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616669916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=moqvSYJz5w/3A2GRyV6UtyLuinuQ5Lw3LUESSdlYPsM=; b=jOyPwPy39RfDiFXoMBtbwnM7+4PXxmI7TMknJiUOs62/geOq/PG2aMbu+6pqcaKyNB2Eg5 LKqC3fiOxA2IgIEIoW+PzbX3oB4cZ3szSFXxWgZuCmofXB8YiGsOOOAlTUUe7Xqzkz+JNM FjoJ3ic51cn8ml8+xNPNl1WnZL1ghh4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-0ocFO0S1MGOYRQyKRnD0JQ-1; Thu, 25 Mar 2021 06:58:19 -0400 X-MC-Unique: 0ocFO0S1MGOYRQyKRnD0JQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B48D719251DD for ; Thu, 25 Mar 2021 10:57:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0665F17258; Thu, 25 Mar 2021 10:57:57 +0000 (UTC) From: Kamil Dudka To: bug-coreutils@gnu.org Subject: [PATCH 1/2] hostname: fix a memory leak with -Dlint Date: Thu, 25 Mar 2021 11:57:55 +0100 Message-Id: <20210325105756.145689-1-kdudka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=63.128.21.124; envelope-from=kdudka@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * src/hostname.c (main): Free allocated memory when compiled with -Dlint. --- src/hostname.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hostname.c b/src/hostname.c index 7d13575d4e9..8ec9aad4d34 100644 --- a/src/hostname.c +++ b/src/hostname.c @@ -104,6 +104,9 @@ main (int argc, char **argv) if (hostname == NULL) die (EXIT_FAILURE, errno, _("cannot determine hostname")); printf ("%s\n", hostname); +#ifdef lint + free(hostname); +#endif } if (optind + 1 < argc) -- 2.26.3 ------------=_1616696582-28091-1--