qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>,
	Juraj Marcin <jmarcin@redhat.com>
Subject: [PULL 27/27] tests/unit/test-util-sockets: fix mem-leak on error object
Date: Wed, 28 May 2025 12:05:07 +0200	[thread overview]
Message-ID: <20250528100507.313906-28-thuth@redhat.com> (raw)
In-Reply-To: <20250528100507.313906-1-thuth@redhat.com>

From: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>

The test fails with --enable-asan as the error struct is never freed.
In the case where the test expects a success but it fails, let's also
report the error for debugging (it will be freed internally).

Fixes 316e8ee8d6 ("util/qemu-sockets: Refactor inet_parse() to use QemuOpts")

Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Message-ID: <518d94c7db20060b2a086cf55ee9bffab992a907.1748280011.git.matheus.bernardino@oss.qualcomm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/unit/test-util-sockets.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c
index 8492f4d68f2..ee66d727c38 100644
--- a/tests/unit/test-util-sockets.c
+++ b/tests/unit/test-util-sockets.c
@@ -341,8 +341,12 @@ static void inet_parse_test_helper(const char *str,
     int rc = inet_parse(&addr, str, &error);
 
     if (success) {
+        if (error) {
+            error_report_err(error);
+        }
         g_assert_cmpint(rc, ==, 0);
     } else {
+        error_free(error);
         g_assert_cmpint(rc, <, 0);
     }
     if (exp_addr != NULL) {
-- 
2.49.0



  parent reply	other threads:[~2025-05-28 10:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28 10:04 [PULL 00/27] Functional tests, Microblaze endianness & pc/q35 cleanups Thomas Huth
2025-05-28 10:04 ` [PULL 01/27] tests/functional/test_sparc64_tuxrun: Explicitly set the 'sun4u' machine Thomas Huth
2025-05-28 10:04 ` [PULL 02/27] tests/functional/test_mips_malta: Re-enable the check for the PCI host bridge Thomas Huth
2025-05-28 10:04 ` [PULL 03/27] tests/functional/test_mem_addr_space: Use set_machine() to select the machine Thomas Huth
2025-05-28 10:04 ` [PULL 04/27] tests/functional: add skipLockedMemoryTest decorator Thomas Huth
2025-05-28 10:04 ` [PULL 05/27] tests/functional: add memlock tests Thomas Huth
2025-05-28 10:04 ` [PULL 06/27] hw/microblaze: Add endianness property to the petalogix_s3adsp1800 machine Thomas Huth
2025-05-28 10:04 ` [PULL 07/27] tests/functional: Test both microblaze s3adsp1800 endianness variants Thomas Huth
2025-05-28 10:04 ` [PULL 08/27] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu Thomas Huth
2025-05-28 10:04 ` [PULL 09/27] docs: Deprecate the qemu-system-microblazeel binary Thomas Huth
2025-05-28 10:04 ` [PULL 10/27] hw/i386/pc: Remove deprecated pc-q35-2.4 and pc-i440fx-2.4 machines Thomas Huth
2025-05-28 10:04 ` [PULL 11/27] hw/i386/pc: Remove PCMachineClass::broken_reserved_end field Thomas Huth
2025-05-28 10:04 ` [PULL 12/27] hw/i386/pc: Remove pc_compat_2_4[] array Thomas Huth
2025-05-28 10:04 ` [PULL 13/27] hw/core/machine: Remove hw_compat_2_4[] array Thomas Huth
2025-05-28 10:04 ` [PULL 14/27] hw/net/e1000: Remove unused E1000_FLAG_MAC flag Thomas Huth
2025-05-28 10:04 ` [PULL 15/27] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_MIGRATE_EXTRA definition Thomas Huth
2025-05-28 10:04 ` [PULL 16/27] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_DISABLE_PCIE definition Thomas Huth
2025-05-28 10:04 ` [PULL 17/27] hw/i386/pc: Remove deprecated pc-q35-2.5 and pc-i440fx-2.5 machines Thomas Huth
2025-05-28 10:04 ` [PULL 18/27] hw/i386/x86: Remove X86MachineClass::save_tsc_khz field Thomas Huth
2025-05-28 10:04 ` [PULL 19/27] hw/nvram/fw_cfg: Remove legacy FW_CFG_ORDER_OVERRIDE Thomas Huth
2025-05-28 10:05 ` [PULL 20/27] hw/core/machine: Remove hw_compat_2_5[] array Thomas Huth
2025-05-28 10:05 ` [PULL 21/27] hw/scsi/vmw_pvscsi: Remove PVSCSI_COMPAT_OLD_PCI_CONFIGURATION definition Thomas Huth
2025-05-28 10:05 ` [PULL 22/27] hw/scsi/vmw_pvscsi: Remove PVSCSI_COMPAT_DISABLE_PCIE_BIT definition Thomas Huth
2025-05-28 10:05 ` [PULL 23/27] hw/scsi/vmw_pvscsi: Convert DeviceRealize -> InstanceInit Thomas Huth
2025-05-28 10:05 ` [PULL 24/27] hw/net/vmxnet3: Remove VMXNET3_COMPAT_FLAG_OLD_MSI_OFFSETS definition Thomas Huth
2025-05-28 10:05 ` [PULL 25/27] hw/net/vmxnet3: Remove VMXNET3_COMPAT_FLAG_DISABLE_PCIE definition Thomas Huth
2025-05-28 10:05 ` [PULL 26/27] hw/net/vmxnet3: Merge DeviceRealize in InstanceInit Thomas Huth
2025-05-28 10:05 ` Thomas Huth [this message]
2025-05-28 19:23 ` [PULL 00/27] Functional tests, Microblaze endianness & pc/q35 cleanups Stefan Hajnoczi
2025-05-28 20:12   ` Thomas Huth
2025-06-04  7:51     ` Alexandr Moshkov
2025-06-04 13:11       ` Stefan Hajnoczi
2025-06-04 13:19         ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250528100507.313906-28-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=jmarcin@redhat.com \
    --cc=matheus.bernardino@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).