[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] qga: Fix memory leak in split_list

From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] qga: Fix memory leak in split_list
Date: Tue, 18 Oct 2022 08:31:22 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.1

On 18/10/22 06:46, Miaoqian Lin wrote:
We should use g_strfreev to free the memory allocated by g_strsplit().
Use g_free() will cause a memory leak.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
  qga/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/main.c b/qga/main.c
index 5a9d8252e075..04902076b25d 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -934,7 +934,7 @@ static GList *split_list(const gchar *str, const gchar 
      for (i = 0; strv[i]; i++) {
          list = g_list_prepend(list, strv[i]);
-    g_free(strv);
+    g_strfreev(strv);
return list;

Fixes: 4bca81ceed ("qga: make split_list() return allocated strings")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]