All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/7] tests/qtest/npcm7xx_emc_test: Don't leak cmd_line
Date: Tue, 12 Mar 2024 20:23:13 +0100	[thread overview]
Message-ID: <1047e3a1-2396-452b-8a53-14c756c7d796@redhat.com> (raw)
In-Reply-To: <20240312183810.557768-2-peter.maydell@linaro.org>

On 12/03/2024 19.38, Peter Maydell wrote:
> In test_rx() and test_tx() we allocate a GString *cmd_line
> but never free it. This is pretty harmless in a test case, but
> Coverity spotted it.
> 
> Resolves: Coverity CID 1507122
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   tests/qtest/npcm7xx_emc-test.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c
> index 63f6cadb5cc..2e1a1a6d702 100644
> --- a/tests/qtest/npcm7xx_emc-test.c
> +++ b/tests/qtest/npcm7xx_emc-test.c
> @@ -789,7 +789,7 @@ static void emc_test_ptle(QTestState *qts, const EMCModule *mod, int fd)
>   static void test_tx(gconstpointer test_data)
>   {
>       const TestData *td = test_data;
> -    GString *cmd_line = g_string_new("-machine quanta-gsj");
> +    g_autoptr(GString) cmd_line = g_string_new("-machine quanta-gsj");
>       int *test_sockets = packet_test_init(emc_module_index(td->module),
>                                            cmd_line);
>       QTestState *qts = qtest_init(cmd_line->str);
> @@ -814,7 +814,7 @@ static void test_tx(gconstpointer test_data)
>   static void test_rx(gconstpointer test_data)
>   {
>       const TestData *td = test_data;
> -    GString *cmd_line = g_string_new("-machine quanta-gsj");
> +    g_autoptr(GString) cmd_line = g_string_new("-machine quanta-gsj");
>       int *test_sockets = packet_test_init(emc_module_index(td->module),
>                                            cmd_line);
>       QTestState *qts = qtest_init(cmd_line->str);

Reviewed-by: Thomas Huth <thuth@redhat.com>



  reply	other threads:[~2024-03-12 19:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 18:38 [PATCH 0/7] various: 7 minor Coverity fixes Peter Maydell
2024-03-12 18:38 ` [PATCH 1/7] tests/qtest/npcm7xx_emc_test: Don't leak cmd_line Peter Maydell
2024-03-12 19:23   ` Thomas Huth [this message]
2024-03-13  6:52   ` Thomas Huth
2024-03-12 18:38 ` [PATCH 2/7] tests/unit/socket-helpers: Don't close(-1) Peter Maydell
2024-03-22 11:51   ` Thomas Huth
2024-03-12 18:38 ` [PATCH 3/7] net/af-xdp.c: Don't leak sock_fds array in net_init_af_xdp() Peter Maydell
2024-03-12 18:38 ` [PATCH 4/7] hw/misc/pca9554: Correct error check bounds in get/set pin functions Peter Maydell
2024-03-12 18:38 ` [PATCH 5/7] hw/nvram/mac_nvram: Report failure to write data Peter Maydell
2024-03-12 20:19   ` Philippe Mathieu-Daudé
2024-03-12 18:38 ` [PATCH 6/7] tests/unit/test-throttle: Avoid unintended integer division Peter Maydell
2024-03-12 19:22   ` Thomas Huth
2024-03-12 18:38 ` [PATCH 7/7] tests/qtest/libqtest.c: Check for g_setenv() failure Peter Maydell
2024-03-12 20:20   ` Philippe Mathieu-Daudé
2024-03-12 19:06 ` [PATCH 0/7] various: 7 minor Coverity fixes Richard Henderson

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=1047e3a1-2396-452b-8a53-14c756c7d796@redhat.com \
    --to=thuth@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.