From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 6A0651F8C8 for ; Thu, 7 Oct 2021 10:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240768AbhJGKDn (ORCPT ); Thu, 7 Oct 2021 06:03:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232642AbhJGKDl (ORCPT ); Thu, 7 Oct 2021 06:03:41 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B74DC061746 for ; Thu, 7 Oct 2021 03:01:47 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id v25so17268442wra.2 for ; Thu, 07 Oct 2021 03:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LEfwCf43QO1pqRoSXsotu02cyLzxMw2j6ARgGPFOoQs=; b=NUAqo3rAqTMRZTBL/xpNfkqpwcUjWNT406yGA6ofXRGd82hOkiUirG/+ZMJY3iDK+A XMPlLHLcOlqtcWHFloRDXWJLC4V8wttnTEAvIH/tbgQ0JuuY5afppwTyLKZNdvzZCuIt /tz8Oi1MC2DjIdkOPNOPOvDyQHBzdKJ1CTEltBtduwynNIOLTe0fYNplwqOoiChGlfjM HvLwpLX/oSVaF5YITT8n0g9D66gg4dquu7comlq8ykwJtbbGOzq7MI7WdtdpHOvlsbWm +r/UdtadkcfX8ioyV0Y9vRGbs6ZYOXaGIJcaDBg5zojTu1Zy1+EVU0iIyTd/cZ/sOZbs kAJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LEfwCf43QO1pqRoSXsotu02cyLzxMw2j6ARgGPFOoQs=; b=JUNOE3mapQ4lfU4YDvucQTAZ0RmVGaB64NBgVRpUmADkc1/z7nY6OOHQ4Dh70T0VVH HHv1oZglsg7MT8CdpBslggxsSNC8h+p60ltSyIn+W0PYyqEktDYN/Ng49ubBfghmkvjk i53NN+Db1P1HtpvrV6b/469j4gEAKZZ7z+P/fpOM4ME8UyWthDmNYDIl2ju44KWJQFW0 r6N2n/sdLir0j1/zMuHccSnh66GKj4roZMSCIcAAyZ85dTXOCZceLQuQbuQoiDiPDn1M adlwuIYYNRvlafwWS3vJ2TOHqop0NXiObwDIt0+SdXgJv1CAyfnQ8SX5vXzmVnzqyeYw kSyg== X-Gm-Message-State: AOAM530HEBJwHoVbpLaUs0/ChsQzfsbcwAf+ezmHJGLQyebLyObrA9Kh 4dsiaENwLGq9jUEDvy8S4dNidAqwkxixQg== X-Google-Smtp-Source: ABdhPJzB02JW1TEz8VFwTlNAHbkhecxE/GM5onQNK81FF8HPsxcIph1cU0l7uWv+/ctMP/qpFu4QmA== X-Received: by 2002:a5d:6d86:: with SMTP id l6mr4182008wrs.293.1633600905635; Thu, 07 Oct 2021 03:01:45 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id f16sm628559wrr.53.2021.10.07.03.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 03:01:45 -0700 (PDT) From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= To: git@vger.kernel.org Cc: Junio C Hamano , Elijah Newren , =?UTF-8?q?Martin=20=C3=85gren?= , Andrzej Hunt , Jeff King , =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Subject: [PATCH v2 1/7] tests: fix a memory leak in test-prio-queue.c Date: Thu, 7 Oct 2021 12:01:31 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.1446.g6af949f83bd In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix a memory leak in t/helper/test-prio-queue.c, the lack of freeing the memory with clear_prio_queue() has been there ever since this code was originally added in b4b594a3154 (prio-queue: priority queue of pointers to structs, 2013-06-06). By fixing this leak we can cleanly run t0009-prio-queue.sh under SANITIZE=leak, so annotate it as such with TEST_PASSES_SANITIZE_LEAK=true. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/helper/test-prio-queue.c | 2 ++ t/t0009-prio-queue.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c index f4028442e37..133b5e6f4ae 100644 --- a/t/helper/test-prio-queue.c +++ b/t/helper/test-prio-queue.c @@ -46,5 +46,7 @@ int cmd__prio_queue(int argc, const char **argv) } } + clear_prio_queue(&pq); + return 0; } diff --git a/t/t0009-prio-queue.sh b/t/t0009-prio-queue.sh index 3941ad25286..eea99107a48 100755 --- a/t/t0009-prio-queue.sh +++ b/t/t0009-prio-queue.sh @@ -1,6 +1,8 @@ #!/bin/sh test_description='basic tests for priority queue implementation' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh cat >expect <<'EOF' -- 2.33.0.1446.g6af949f83bd