From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15352 invoked by alias); 3 Dec 2015 23:37:23 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37298 Received: (qmail 5000 invoked from network); 3 Dec 2015 23:37:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=a2NT5ZcS8QASTxqq7a7ls6EMOMw=; b=Ax9/Z/ M4+JFtV2M3dhybm6Zcf02jWeFM8rTzDQNq37cpMPJBvTRfCjkWhh3KDB2f5UiJKG kRm87Glk/iQypArcR2NNW7bbwpkTusmiZUG/LbRrQWWo0chIthJ6MIspdsP8SH+s uga8s+/EyE6BoO8lklEC0M6TANELV8035BL78= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=a2NT5ZcS8QASTxqq7a7ls6EMOMw=; b=Gzcl1 F7DSr3A54xsIhnq6WeuCKuaxAc+7XSMovvD5BXzD7cnKK9TFRAxCbzb+6Hqn7piS O5biEYETezKB2sIUbiN/OeVC31Bew+igs5oqUzvu3P8RNsTsmDGf0flp6Zg/ax+E u0hHR8M9r46Y/Qg1PkS8B9ZA+LL4btCiYpo1yo= X-Sasl-enc: oExDHkGjIoeRU9rPBatQLNlet+XtfxO1BGvGvShQtYkY 1449185841 Date: Thu, 3 Dec 2015 23:37:19 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: [PATCH 3/3] Constify two local variables. Message-ID: <20151203233719.GE1955@tarsus.local2> References: <20151202003654.GE2462@tarsus.local2> <151201171121.ZM710@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <151201171121.ZM710@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) Bart Schaefer wrote on Tue, Dec 01, 2015 at 17:11:21 -0800: > On Dec 2, 12:36am, Daniel Shahaf wrote: > } Subject: Re: [PATCH 3/3] Constify two local variables. > } > } #define N (sizeof(void*) * arrlen(vals)) > } vals = getfn() > } munge_in_place(vals) > } dummy = zalloc(N) > } memcpy(dummy, vals, N) > } setfn(dummy) > > Would that memcpy() really work, or would it need to be zarrdup() to copy > each of the elements as well? Because e.g. arrsetfn() does freearray(). I think it would work, because setarrvalue() in HEAD calls freearray() on the values array, implying that the individual elements are already permanently allocated. --- In the meantime I've found a reproducible invalid free() with this patchset (reproducible by invoking _gnu_generic on ": Sr" in the source tree). I haven't investigated yet. Daniel