Hi

On Tue, Oct 18, 2022 at 8:47 AM Miaoqian Lin <linmq...@gmail.com> 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 <linmq...@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
> *delim)
>      for (i = 0; strv[i]; i++) {
>          list = g_list_prepend(list, strv[i]);
>      }
> -    g_free(strv);
> +    g_strfreev(strv);
>

No, this is intentional. We are building a list of allocated strings, we
shouldn't free those.

thanks

Reply via email to