[PATCH v2 23/40] plugins/lockstep: preserve sock_path

Alex Bennée posted 40 patches 2 months, 1 week ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Paolo Bonzini <pbonzini@redhat.com>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Paul Burton <paulburton@kernel.org>, Aleksandar Rikalo <arikalo@gmail.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Stefan Hajnoczi <stefanha@redhat.com>, Mads Ynddal <mads@ynddal.dk>
[PATCH v2 23/40] plugins/lockstep: preserve sock_path
Posted by Alex Bennée 2 months, 1 week ago
We can't assign sock_path directly from the autofree'd GStrv, take a
copy.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 contrib/plugins/lockstep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
index 237543b43a..111ec3fa27 100644
--- a/contrib/plugins/lockstep.c
+++ b/contrib/plugins/lockstep.c
@@ -347,7 +347,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
                 return -1;
             }
         } else if (g_strcmp0(tokens[0], "sockpath") == 0) {
-            sock_path = tokens[1];
+            sock_path = strdup(tokens[1]);
         } else {
             fprintf(stderr, "option parsing failed: %s\n", p);
             return -1;
-- 
2.39.2


Re: [PATCH v2 23/40] plugins/lockstep: preserve sock_path
Posted by Manos Pitsidianakis 2 months, 1 week ago
On Fri, 5 Jul 2024 at 11:57, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> We can't assign sock_path directly from the autofree'd GStrv, take a
> copy.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  contrib/plugins/lockstep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
> index 237543b43a..111ec3fa27 100644
> --- a/contrib/plugins/lockstep.c
> +++ b/contrib/plugins/lockstep.c
> @@ -347,7 +347,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
>                  return -1;
>              }
>          } else if (g_strcmp0(tokens[0], "sockpath") == 0) {
> -            sock_path = tokens[1];
> +            sock_path = strdup(tokens[1]);

s/strdup/g_strdup
?

Otherwise,

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

>          } else {
>              fprintf(stderr, "option parsing failed: %s\n", p);
>              return -1;
> --
> 2.39.2
>
>