From patchwork Thu Oct 4 10:07:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 10625843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEBD115E2 for ; Thu, 4 Oct 2018 10:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DB8D28C49 for ; Thu, 4 Oct 2018 10:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9191328C52; Thu, 4 Oct 2018 10:08:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474A628C49 for ; Thu, 4 Oct 2018 10:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727614AbeJDRAc (ORCPT ); Thu, 4 Oct 2018 13:00:32 -0400 Received: from smtp-out-2.talktalk.net ([62.24.135.66]:55839 "EHLO smtp-out-2.talktalk.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727599AbeJDRAb (ORCPT ); Thu, 4 Oct 2018 13:00:31 -0400 Received: from lindisfarne.localdomain ([92.28.142.68]) by smtp.talktalk.net with SMTP id 80XsgfYebVlGZ80Y0gOCEs; Thu, 04 Oct 2018 11:07:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=talktalk.net; s=cmr1711; t=1538647677; bh=lrxcaQQEPF84V3THxbNrjBkNNPqKfNW5Zo9l+9oKBKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To; b=hrXL38+s/R3qPaV9fo+iuueVGPqpVwWOVM6hNeLcecBPW9xsGaNbZLwUP+fWC2F1i m+E+C/V93AMZt/D0LTHBSRXIxB6onQY0ipVyjVbOtwXifRxVu7/NzLEvSX3lj+FzHq qHVF4Aze3BeqyJpY+30BOyz9O3cKeMeTVRdO45so= X-Originating-IP: [92.28.142.68] X-Spam: 0 X-OAuthority: v=2.3 cv=JcuSU3CV c=1 sm=1 tr=0 a=UGDAwvN9cmeZh0o4udnnNw==:117 a=UGDAwvN9cmeZh0o4udnnNw==:17 a=evINK-nbAAAA:8 a=FVCVqbMd_-HzSxj5j7YA:9 a=Vm1BYxNBd15DAg0M:21 a=xFJIqMZrjgypuhHE:21 a=RfR_gqz1fSpA9VikTjo0:22 From: Phillip Wood To: Stefan Beller , =?utf-8?q?Martin_=C3=85gren?= Cc: Git Mailing List , Junio C Hamano , Phillip Wood Subject: [PATCH v2 5/5] diff --color-moved: fix a memory leak Date: Thu, 4 Oct 2018 11:07:45 +0100 Message-Id: <20181004100745.4568-6-phillip.wood@talktalk.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181004100745.4568-1-phillip.wood@talktalk.net> References: <20181002175514.31495-1-phillip.wood@talktalk.net> <20181004100745.4568-1-phillip.wood@talktalk.net> MIME-Version: 1.0 Reply-To: Phillip Wood X-CMAE-Envelope: MS4wfJrpvBDoyyRz2UNfWGAe7QHJkQo6tOP+Tv2ksOTAbTDMnE5qc2HLrRyEnUoQYGbzwLyc1nJLyN0TLeBqoxc3dm6I8tW8YSKvCLB+3Hwhxr3NwHfmA9Ec c/1RPNjEPQbm6ABxtJU1fhAGgd1E9pCEQA/zQgTatQSA5ekluG0wQFzC6dlP4zYdJu1faJ8miNTeFX67+dXcdmb6JKmXqctUfD3lu9g4WeoAh4sW727m3pAT DgNQELR8KRODSCFD85eQ7OgFb/ehuDYs10AQPAEL9c2Pxdk+t1Wal2Oi+ts8WiVCmGGCatHR8q3JvRtqo/lqtA== Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Phillip Wood Free the hashmap items as well as the hashmap itself. This was found with asan. Signed-off-by: Phillip Wood Reviewed-by: Stefan Beller --- diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c index 69f6309db6..100d24b9c4 100644 --- a/diff.c +++ b/diff.c @@ -5768,8 +5768,8 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o) if (o->color_moved == COLOR_MOVED_ZEBRA_DIM) dim_moved_lines(o); - hashmap_free(&add_lines, 0); - hashmap_free(&del_lines, 0); + hashmap_free(&add_lines, 1); + hashmap_free(&del_lines, 1); } for (i = 0; i < esm.nr; i++)