From patchwork Wed Jan 8 18:47:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1219857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-516940-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="AMJ4dF9d"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="KBBnMAAu"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47tJCX48zCz9sPK for ; Thu, 9 Jan 2020 05:47:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=nc6zeAW+DAR3VHU9 lNqSqD+tosZatKtHn47nFaXdB1yONafRc8nLwHFeoDCS6ZnHJmc1cOVhvnWUX0gH 5G+ddEOSFjrzkHy5DM9M/3sU5ysiKEBk09AR/Rl7U3KQYQGWrUJWFBu9MneNuB2b 9nu3nqn3Ui2HBGXL572IzwSUqU4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=jrRpOKA2+FIlV9Pq9vJ5nu Ei58A=; b=AMJ4dF9dbpD4bmWy5khsJ9ww4Wz/bfOp1ZD9DbXGLooalIFt+dtOe6 kEEVCsDLx6CXvogrmvPVS+9czr8H30YiVpZ2Z9bqVMvIUj+FZQwbKcdya0PM9gp0 zdohN5hJBue6QA6QR6kg/A5Kv0gmphAkOLULgfFBfpyeQYKi1L+w8= Received: (qmail 81523 invoked by alias); 8 Jan 2020 18:47:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 81515 invoked by uid 89); 8 Jan 2020 18:47:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=2339 X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 Jan 2020 18:47:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578509261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RO7pcCmyhPc+Elml2UHKrw3PCabz0kUz/85EYqJwNq8=; b=KBBnMAAux1pEwjU6rkTL3N/ZXl+1V/oEEBKaE4Y8iOGCwD79e6hN6QHNvJRSywDOm8CV73 QZRFewp7O4FzReX8NH9jomVVsJpwJSU7ZPRw5Bd6nECwhGLxdUcECJlMXiwxknz1wS+cWd ZVrFCBXfzKMVdzCYJRkSvvzgGOigXS0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-16-wkQbaGTaNyaaV_2W_5TA0A-1; Wed, 08 Jan 2020 13:47:39 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 04F47800D4C for ; Wed, 8 Jan 2020 18:47:39 +0000 (UTC) Received: from t470.redhat.com (ovpn-117-41.phx2.redhat.com [10.3.117.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9749810027A6; Wed, 8 Jan 2020 18:47:38 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [committed] hash-map-tests.c: fix memory leak Date: Wed, 8 Jan 2020 13:47:36 -0500 Message-Id: <20200108184736.19446-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes This commit makes "make selftest-valgrind" clean by fixing this leak: 4 bytes in 1 blocks are definitely lost in loss record 1 of 734 at 0x483AB1A: calloc (vg_replace_malloc.c:762) by 0x261DBE0: xcalloc (xmalloc.c:162) by 0x2538C46: selftest::test_map_of_strings_to_int() (hash-map-tests.c:87) by 0x253ABD2: selftest::hash_map_tests_c_tests() (hash-map-tests.c:307) by 0x24A885B: selftest::run_tests() (selftest-run-tests.c:65) by 0x1373D80: toplev::run_self_tests() (toplev.c:2339) by 0x1373FA7: toplev::main(int, char**) (toplev.c:2421) by 0x2550EFF: main (main.c:39) Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Committed to trunk as r280015 under the "obvious" rule. gcc/ChangeLog: * hash-map-tests.c (selftest::test_map_of_strings_to_int): Fix memory leak. --- gcc/hash-map-tests.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/hash-map-tests.c b/gcc/hash-map-tests.c index c351bb22ddba..635740290658 100644 --- a/gcc/hash-map-tests.c +++ b/gcc/hash-map-tests.c @@ -101,6 +101,8 @@ test_map_of_strings_to_int () ASSERT_EQ (1, string_map.elements ()); ASSERT_EQ (true, string_map.put (another_ant, 5)); ASSERT_EQ (1, string_map.elements ()); + + free (another_ant); } /* Construct a hash_map using int_hash and verify that