From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 5AB7A3875432 for ; Wed, 4 Oct 2023 15:28:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5AB7A3875432 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696433281; 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: in-reply-to:in-reply-to:references:references; bh=LcjEmzpvyN8dhwAiuLUVxf6SJSYsOQKJE2L0e1DZ4Tw=; b=XQzM11qcj3hhwN+kMZ7vKX1U16ht7zkcO4c8BN/+M+5gZ+YJTFBxlTcODTiiADZpk6Mnbl KTFficFipWRKfmsxus0IcCPYT4A9j9yKq1qbUW6nsvswmjs2PvTbrh4ZLEu2FszMnL1sxo rkbEoLg/PoCZgRgLUgd7qgoXOtphuqU= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-277-NfJRMbGUNGS0uRKsZiLl7A-1; Wed, 04 Oct 2023 11:27:54 -0400 X-MC-Unique: NfJRMbGUNGS0uRKsZiLl7A-1 Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-570096f51acso820336a12.0 for ; Wed, 04 Oct 2023 08:27:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696433273; x=1697038073; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LcjEmzpvyN8dhwAiuLUVxf6SJSYsOQKJE2L0e1DZ4Tw=; b=gaIa2fn+GJ5FtpjHcffV2YhE5m95POa2Kh/KHHEXquCq9PIf2UHZiFP+La1AKhIsJJ O2fMPVwOWcXr8KBaAlZtqmPi6O6B3CVu48h8AYjLmnKMdJnz2i7vphbQFrdt3N0o2EmA dG7qhxtEei++Boz0jXGRXpDFSDeNfUwyT0d4MpzFfxPZpDYyGLZbxzwuUCQuHU44PwXw EjxZFxSPq90Nury3uoN6UlUN2YERgGJCFIRZaj7Veahv7EFQ81LZexjQqW0q3iWt7j0w KkJVfkiSphAj1KFgTiM0Hc49p2NAtbwrViOWPYZY9nNvGiLlQ/ylh3zTXBmnJjoXlLJ9 FDfQ== X-Gm-Message-State: AOJu0YwBxKUjJt/0Iyx80eTV0ML8gupjEBv2jTq9SrJZKTbCIpIK4+Wd yl2F3s/BPZBc4ULIRGxkLjlGIhtFI74diCPGwg/EzFBu//fTxKyF9kOAX0c4DjsQU3sVtqccypF mkf5jmmE7EN2PmxEfBl0VLIrsdYS9zh+2nDGbUe0pGZy4PSs= X-Received: by 2002:a17:90b:4b4b:b0:271:78a0:8ab2 with SMTP id mi11-20020a17090b4b4b00b0027178a08ab2mr8305562pjb.24.1696433273450; Wed, 04 Oct 2023 08:27:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEz8lX5UGOtA5bLSN1RtE+L/5gQ2kC5yWaKi4FwmJ3oWSDdu/lxLZAybreeY54/Nlp5kXfaPYkSdMuY66E/+/I= X-Received: by 2002:a17:90b:4b4b:b0:271:78a0:8ab2 with SMTP id mi11-20020a17090b4b4b00b0027178a08ab2mr8305541pjb.24.1696433273181; Wed, 04 Oct 2023 08:27:53 -0700 (PDT) MIME-Version: 1.0 References: <20230928141125.600816-1-josimmon@redhat.com> <20231004140001.GH4098455@oak> In-Reply-To: <20231004140001.GH4098455@oak> From: Arjun Shankar Date: Wed, 4 Oct 2023 17:27:42 +0200 Message-ID: Subject: Re: [PATCH v2] nss: Get rid of alloca usage in makedb's write_output. To: Joe Simmons-Talbott Cc: libc-alpha@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > > The way scratch_buffer_init and scratch_buffer_set_array_size are > > implemented currently, a failure of the set_array_size here looks like > > it doesn't necessarily need a scratch_buffer_free to be called after > > failure because there's nothing to be freed. But I think calling > > scratch_buffer_free here before returning here is the safer bet. > > > > I haven't been including a scratch_buffer_free call on failure of > scratch_buffer_set_array_size. Both failure code paths for > scratch_buffer_set_array_size reset the buffer to the default character > array and any heap allocated storage is freed. If there is agreement > that a call to scratch_buffer_free is desired I'm happy to add it. You're right. There is some code that does a free (e.g. an instance in catgets/gencat.c, and one in nscd/nscd_getgr_r.c via a goto), and some that does not (e.g. stdio-common/fxprintf.c and sysdeps/posix/getaddrinfo.c -- which as you said, you've committed recently). Reviewed-by: Arjun Shankar Cheers! -- Arjun Shankar he/him/his