All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qtest/npcm7xx_pwm-test: Fix memory leak in mft_qom_set
@ 2022-05-31  8:09 Miaoqian Lin
  2022-05-31 16:31 ` Hao Wu
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-05-31  8:09 UTC (permalink / raw)
  To: Havard Skinnemoen, Tyrone Ting, Thomas Huth, Laurent Vivier,
	Paolo Bonzini, qemu-arm, qemu-devel
  Cc: linmq006

g_strdup_printf() allocated memory for path, we should free it with
g_free() when no longer needed.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 tests/qtest/npcm7xx_pwm-test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/qtest/npcm7xx_pwm-test.c b/tests/qtest/npcm7xx_pwm-test.c
index c4a5fdcacd79..e320a625c4b6 100644
--- a/tests/qtest/npcm7xx_pwm-test.c
+++ b/tests/qtest/npcm7xx_pwm-test.c
@@ -268,6 +268,9 @@ static void mft_qom_set(QTestState *qts, int index, const char *name,
             path, name, value);
     /* The qom set message returns successfully. */
     g_assert_true(qdict_haskey(response, "return"));
+
+    qobject_unref(response);
+    g_free(path);
 }
 
 static uint32_t get_pll(uint32_t con)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] qtest/npcm7xx_pwm-test: Fix memory leak in mft_qom_set
  2022-05-31  8:09 [PATCH] qtest/npcm7xx_pwm-test: Fix memory leak in mft_qom_set Miaoqian Lin
@ 2022-05-31 16:31 ` Hao Wu
  0 siblings, 0 replies; 2+ messages in thread
From: Hao Wu @ 2022-05-31 16:31 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Havard Skinnemoen, Tyrone Ting, Thomas Huth, Laurent Vivier,
	Paolo Bonzini, qemu-arm, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

On Tue, May 31, 2022 at 6:18 AM Miaoqian Lin <linmq006@gmail.com> wrote:

> g_strdup_printf() allocated memory for path, we should free it with
> g_free() when no longer needed.
>
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
>
Reviewed-by: Hao Wu <wuhaotsh@google.com>

> ---
>  tests/qtest/npcm7xx_pwm-test.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tests/qtest/npcm7xx_pwm-test.c
> b/tests/qtest/npcm7xx_pwm-test.c
> index c4a5fdcacd79..e320a625c4b6 100644
> --- a/tests/qtest/npcm7xx_pwm-test.c
> +++ b/tests/qtest/npcm7xx_pwm-test.c
> @@ -268,6 +268,9 @@ static void mft_qom_set(QTestState *qts, int index,
> const char *name,
>              path, name, value);
>      /* The qom set message returns successfully. */
>      g_assert_true(qdict_haskey(response, "return"));
> +
> +    qobject_unref(response);
> +    g_free(path);
>  }
>
>  static uint32_t get_pll(uint32_t con)
> --
> 2.25.1
>
>
>

[-- Attachment #2: Type: text/html, Size: 1593 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-31 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31  8:09 [PATCH] qtest/npcm7xx_pwm-test: Fix memory leak in mft_qom_set Miaoqian Lin
2022-05-31 16:31 ` Hao Wu

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.