qtest/npcm7xx_pwm-test: Fix memory leak in mft_qom_set
authorMiaoqian Lin <linmq006@gmail.com>
Tue, 31 May 2022 08:09:21 +0000 (12:09 +0400)
committerThomas Huth <thuth@redhat.com>
Fri, 3 Jun 2022 06:03:28 +0000 (08:03 +0200)
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>
Message-Id: <20220531080921.4704-1-linmq006@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/qtest/npcm7xx_pwm-test.c

index c4a5fdcacd7929989b816b5e520691efeae67093..e320a625c4b6127426c1d78f07a267e667a8dbb2 100644 (file)
@@ -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)