From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4528 invoked by alias); 30 Nov 2015 16:28:18 -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: 37258 Received: (qmail 11221 invoked from network); 30 Nov 2015 16:28:17 -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-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=2bSfiGeQ02PUe4kmq+6OqOhnmqBPthkJ70QdNK2lVWg=; b=a+O03odX6r6lxmwtI/fmqaN9DSoCDdtFWMhCejHpg7J61E/OShBmCtoFLVpnUtj90H EQAjGkxNZi33rXteKpDsLt71UNVM1NLcVJCtdqa5pLMGwdICBwuW224U5eG/0hkZ381A s2iMD8WU/oGr43jrxCSretpx/bhnKYsc/uf1+yR0KyMXrGCdTdmvUAgSPtxYucRHeSmB n9FYYjN+7NTEm0QN/N2ZQMJsNzwX1A0wMu1vnz5f7Cxk8HpzEtpWU3AZORg8BzEw07w0 rZMvjDG9QBzphpJgkumlKK+u6nUqy6PCtsgsN1+8D4k9KIxFFX/kEsnYy7Tp0GVmsP8g 1PZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=2bSfiGeQ02PUe4kmq+6OqOhnmqBPthkJ70QdNK2lVWg=; b=eupLatQj/CDq23JXP28NoS4Nk3QMTZ5atS9ySDMsci1HqSu0z5g0j2kyL9Zvc4+Icw 9gsjnMd3m1qZQ2fjoUHlFUU/CKfHFEjhDEo1tOF5NbJS7JWH5zPTbyZpoRRhB3fD65ol MGx+/xR2ZAZxeIqsmW0IyoeOb7CZrGftF5Th5WvjRN1fcN5KVXH4pDhSLtcF00VSqxmY 5rqBvYZaHVILaEvJUERjEgLS1tvWbUOjg6sBWO3IIcMS7ePRuSsUZy0r8WF56bQd44C/ lDK7MezlGgAJWz80IF9IrkWTa1qQa99LvS1aGIrp7dkGIeeUTZy1/3ri5Jq8SaPq5YbJ f71w== X-Gm-Message-State: ALoCoQm4H3oTBMchK+Iu4mKdj/4Nk9+BULAouVui6mk2AWigLa2qi3tWIFnts92gOszCU/2slsVN X-Received: by 10.66.234.226 with SMTP id uh2mr73212430pac.6.1448900896053; Mon, 30 Nov 2015 08:28:16 -0800 (PST) From: Bart Schaefer Message-Id: <151130082838.ZM28376@torch.brasslantern.com> Date: Mon, 30 Nov 2015 08:28:38 -0800 In-Reply-To: <20151130155945.GD10968@tarsus.local2> Comments: In reply to Daniel Shahaf "Re: [PATCH 3/3] Constify two local variables." (Nov 30, 3:59pm) References: <20151130032153.GH2504@tarsus.local2> <20151130093832.5321126d@pwslap01u.europe.root.pri> <20151130155945.GD10968@tarsus.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [PATCH 3/3] Constify two local variables. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 30, 3:59pm, Daniel Shahaf wrote: } } I'm asking because I found that $region_highlights' getfn returns } a heap-allocated array, while its setfn calls free() on the array passed } to it, so } . } Param pm = $region_highlights; } values_a = pm->gsu.a->getfn(); } pm->gsu.a->setfn(values_a); } . } is undefined behaviour (calls free() on a heap pointer, triggering SIGABRT). In general you can't pass the result of any getfn() back to its own or anyone else's setfn(). All setfn() should always expect a newly- zshcalloc()d [or the equivalent] array.