diff mbox series

[03/22] parallels: fix memory leak in parallels_open()

Message ID 20230918180100.524843-4-den@openvz.org
State New
Headers show
Series implement discard operation for Parallels images | expand

Commit Message

Denis V. Lunev Sept. 18, 2023, 6 p.m. UTC
We should free opts allocated through qemu_opts_create() at the end.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 block/parallels.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alexander Ivanov Sept. 19, 2023, 9:28 a.m. UTC | #1
On 9/18/23 20:00, Denis V. Lunev wrote:
> We should free opts allocated through qemu_opts_create() at the end.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> ---
>   block/parallels.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/block/parallels.c b/block/parallels.c
> index 428f72de1c..af7be427c9 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -1217,6 +1217,7 @@ fail_format:
>   fail_options:
>       ret = -EINVAL;
>   fail:
> +    qemu_opts_del(opts);
>       /*
>        * "s" object was allocated by g_malloc0 so we can safely
>        * try to free its fields even they were not allocated.

Reviewed-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
diff mbox series

Patch

diff --git a/block/parallels.c b/block/parallels.c
index 428f72de1c..af7be427c9 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -1217,6 +1217,7 @@  fail_format:
 fail_options:
     ret = -EINVAL;
 fail:
+    qemu_opts_del(opts);
     /*
      * "s" object was allocated by g_malloc0 so we can safely
      * try to free its fields even they were not allocated.