From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.2 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 87C681FF40 for ; Mon, 19 Dec 2016 17:15:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933540AbcLSROb (ORCPT ); Mon, 19 Dec 2016 12:14:31 -0500 Received: from mout.gmx.net ([212.227.17.21]:51513 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755042AbcLSRO3 (ORCPT ); Mon, 19 Dec 2016 12:14:29 -0500 Received: from virtualbox ([37.24.141.236]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MWkZL-1c4XpW1G9L-00XwNd; Mon, 19 Dec 2016 18:14:13 +0100 Date: Mon, 19 Dec 2016 18:14:10 +0100 (CET) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: Jeff King cc: Stefan Beller , git@vger.kernel.org, Junio C Hamano , Kevin Daudt , Dennis Kaarsemaker Subject: Re: [PATCH v2 07/34] sequencer (rebase -i): add support for the 'fixup' and 'squash' commands In-Reply-To: <20161215190351.as76panrcz5rgibj@sigill.intra.peff.net> Message-ID: References: <20161215190351.as76panrcz5rgibj@sigill.intra.peff.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K0:8wJZb2P+C+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FusrxQzr79FtX jfVQ/PF Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Peff, On Thu, 15 Dec 2016, Jeff King wrote: > On Tue, Dec 13, 2016 at 04:30:01PM +0100, Johannes Schindelin wrote: > > > + else { > > + unsigned char head[20]; > > + struct commit *head_commit; > > + const char *head_message, *body; > > + > > + if (get_sha1("HEAD", head)) > > + return error(_("need a HEAD to fixup")); > > + if (!(head_commit = lookup_commit_reference(head))) > > + return error(_("could not read HEAD")); > > + if (!(head_message = get_commit_buffer(head_commit, NULL))) > > + return error(_("could not read HEAD's commit message")); > > This get_commit_buffer() may allocate a fresh buffer... > > > + body = strstr(head_message, "\n\n"); > > + if (!body) > > + body = ""; > > + else > > + body = skip_blank_lines(body + 2); > > + if (write_message(body, strlen(body), > > + rebase_path_fixup_msg(), 0)) > > + return error(_("cannot write '%s'"), > > + rebase_path_fixup_msg()); > > ...and then this return leaks the result (the other code path hits > unuse_commit_buffer(), and is fine). Good point. I found another leaked commit buffer in make_patch() and fixed it, too. > This leak was noticed by Coverity. It has a _ton_ of false positives > across the whole project, but it sends out a mail with new ones every > few days, which is usually short enough that I can process it in 30 > seconds or so. Yeah, I get these mails now, thanks to Stephan adding me in response to some issues I introduced with the builtin difftool (and hence I did not get the warnings when I introduced the problems with sequencer-i). Ciao, Dscho