From patchwork Mon Aug 26 02:01:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Hommey X-Patchwork-Id: 11113825 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A876014DE for ; Mon, 26 Aug 2019 02:01:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8513620815 for ; Mon, 26 Aug 2019 02:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729030AbfHZCBm (ORCPT ); Sun, 25 Aug 2019 22:01:42 -0400 Received: from ns332406.ip-37-187-123.eu ([37.187.123.207]:38328 "EHLO glandium.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726552AbfHZCBm (ORCPT ); Sun, 25 Aug 2019 22:01:42 -0400 Received: from glandium by mitsuha.glandium.org with local (Exim 4.92) (envelope-from ) id 1i24K9-0001Eh-8V; Mon, 26 Aug 2019 11:01:37 +0900 From: Mike Hommey To: git@vger.kernel.org Cc: gitster@pobox.com, stefanbeller@gmail.com Subject: [PATCH] commit: free the right buffer in release_commit_memory Date: Mon, 26 Aug 2019 11:01:37 +0900 Message-Id: <20190826020137.4703-1-mh@glandium.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The index field in the commit object is used to find the buffer corresponding to that commit in the buffer_slab. Resetting it first means free_commit_buffer is not going to free the right buffer. Signed-off-by: Mike Hommey --- commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit.c b/commit.c index a98de16e3d..3fe5f8fa9c 100644 --- a/commit.c +++ b/commit.c @@ -364,8 +364,8 @@ struct object_id *get_commit_tree_oid(const struct commit *commit) void release_commit_memory(struct parsed_object_pool *pool, struct commit *c) { set_commit_tree(c, NULL); - c->index = 0; free_commit_buffer(pool, c); + c->index = 0; free_commit_list(c->parents); c->object.parsed = 0;