From nobody Sun May 19 05:50:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689778934; cv=none; d=zohomail.com; s=zohoarc; b=Jc4cIQzI2/fXtEO69JQKoseHFkTSzMhN7o5k7uMoy7zvrO05MXn1JzVe2wGL2GkyDboKl81DPnJLUOgD6e4RzL7CXhWhp3aKAff/nviRVPfcpOZx3qyrj2yYsWxfhDgWuftAthyyW7jn42xlOlq6V75xgv0X+K+FY16C45utTT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689778934; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=que6iuJEIIMG35TRiCvJ/mt6LAIYpcZEmLyUidZkSX0=; b=F1S/F0Y88QE9adTb2BpAvqLh2817H3PE8efMpXdGpN3S3NvtaEH+9FgMEprtjfK9dzHowFUFA7VZzcu6pMN5lBBzoIKFg/DibON97+JNQooB58SXYSagRCU68dzuqPieSzklX5vR9qUPyO6N5n2wIQMJP7RwoO6r3Ni8ag9lRZM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689778934746901.5797637556368; Wed, 19 Jul 2023 08:02:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qM8fw-0003Uy-IE; Wed, 19 Jul 2023 11:01:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qM8fu-0003UT-Vf for qemu-devel@nongnu.org; Wed, 19 Jul 2023 11:01:11 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qM8ft-0001nu-42 for qemu-devel@nongnu.org; Wed, 19 Jul 2023 11:01:10 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3159d5e409dso623101f8f.0 for ; Wed, 19 Jul 2023 08:01:08 -0700 (PDT) Received: from localhost.localdomain ([176.187.201.220]) by smtp.gmail.com with ESMTPSA id h4-20020a05600004c400b00313f07ccca4sm5517833wri.117.2023.07.19.08.01.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 19 Jul 2023 08:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689778867; x=1692370867; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=que6iuJEIIMG35TRiCvJ/mt6LAIYpcZEmLyUidZkSX0=; b=KDL3mzC6kyKOkFt0OpN59nVObASVygIvCp/i3lJRHTla8gf/C5F92fWyMA0fgBQ6hi OQbJ9QxH8WZiTiqg4G7T+HhqUjyuTL+3KBbBlc2PU6GJfzIqh//9uMZPOFAA60XGLTJ4 8ibRC/phN2+jDyE4qO6K1RgDgtsuwVm0eJ6qpmWX4qjEyUdjqkoJWc+KvKN37Jl9uTfJ dBj1lYa/nmPJXwh14TutoiKVKKendReMp23avAhzI2W75T4YesqOio3UJxwZv2HILwro WWq/MxZf8EECQ+93JYGvtAYjIUG1uVSLwosF9NvEDqQB2cdpBdGr2zPrNfq9d0TVol5o aekw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689778867; x=1692370867; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=que6iuJEIIMG35TRiCvJ/mt6LAIYpcZEmLyUidZkSX0=; b=kYLMosxMyFwR2uJZzOfRjOO3GnLo3JQOqflCRTiD3U4TGRQyt76KdJQpKB6rDq8Pnl 8fwXc3vINwx2m1nkG/c1Ujm9LEAgAEnp5iD8ZIIj+U0UF1HvqJz73OtlH7yX6G1VTu7g 2Bm02I1/DJIVKmoj+HZlOVFc6euMBpRa2KdRrIYt4JRXSHQVQcbI3Bst5/Pccluzvxvk KXomt8f33wvqdxsJFGM30YzC0sQjWYAmXvv4l1NzPT9FAP8G9MUD4Rt7QJAGyYDGJ2Sp JJ7zsyCtkQeolqfBdam1zKPtbZEc5ctFodWDb6BwIYrKf6LhnZkRdUCjTxrvbo/aiHOC vr4Q== X-Gm-Message-State: ABy/qLZ0GEa4VyYz8tLSpFSSYyRaX2DzBnKNlABEgb35Gnnc3j+jHqjx Bz5L8VzU1EUPbfjmPhrqvv5gWnwSpEUqxY73hdI= X-Google-Smtp-Source: APBJJlEnsJhL1HOsi5tr+iAgl0GKVtKL4iC+orh5sfx6LxiVPGLgj+GcrrF1YgF8uDAOTjPR7fYntA== X-Received: by 2002:adf:f390:0:b0:314:11e6:da8a with SMTP id m16-20020adff390000000b0031411e6da8amr51045wro.1.1689778867226; Wed, 19 Jul 2023 08:01:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH for-8.1] tests/test-util-filemonitor: Avoid pointless allocations Date: Wed, 19 Jul 2023 17:01:03 +0200 Message-Id: <20230719150103.36634-1-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689778936938100001 Coverity reports few resource leaks. While they are harmless, fix them to avoid them showing on the reports. Reported-by: Coverity (CID 1432615: RESOURCE_LEAK) Fixes: 4f370b1098 ("test-util-filemonitor: Skip test on non-x86 Travis cont= ainers") Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/unit/test-util-filemonitor.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/unit/test-util-filemonitor.c b/tests/unit/test-util-file= monitor.c index b629e10857..3ca687860d 100644 --- a/tests/unit/test-util-filemonitor.c +++ b/tests/unit/test-util-filemonitor.c @@ -398,7 +398,7 @@ test_file_monitor_events(void) }; Error *local_err =3D NULL; GError *gerr =3D NULL; - QFileMonitor *mon =3D qemu_file_monitor_new(&local_err); + QFileMonitor *mon; QemuThread th; GTimer *timer; gchar *dir =3D NULL; @@ -407,12 +407,9 @@ test_file_monitor_events(void) char *pathsrc =3D NULL; char *pathdst =3D NULL; QFileMonitorTestData data; - GHashTable *ids =3D g_hash_table_new(g_int64_hash, g_int64_equal); + GHashTable *ids; char *travis_arch; =20 - qemu_mutex_init(&data.lock); - data.records =3D NULL; - /* * This test does not work on Travis LXD containers since some * syscalls are blocked in that environment. @@ -423,6 +420,12 @@ test_file_monitor_events(void) return; } =20 + mon =3D qemu_file_monitor_new(&local_err); + ids =3D g_hash_table_new(g_int64_hash, g_int64_equal); + + qemu_mutex_init(&data.lock); + data.records =3D NULL; + /* * The file monitor needs the main loop running in * order to receive events from inotify. We must --=20 2.38.1