[PATCH v3 23/24] migration/qemu-file: Define g_autoptr() cleanup function for QEMUFile

Maciej S. Szmigiero posted 24 patches 1 year, 2 months ago
There is a newer version of this series
[PATCH v3 23/24] migration/qemu-file: Define g_autoptr() cleanup function for QEMUFile
Posted by Maciej S. Szmigiero 1 year, 2 months ago
From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>

Automatic memory management helps avoid memory safety issues.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
---
 migration/qemu-file.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index 11c2120edd72..fdf21324df07 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -33,6 +33,8 @@ QEMUFile *qemu_file_new_input(QIOChannel *ioc);
 QEMUFile *qemu_file_new_output(QIOChannel *ioc);
 int qemu_fclose(QEMUFile *f);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QEMUFile, qemu_fclose)
+
 /*
  * qemu_file_transferred:
  *
Re: [PATCH v3 23/24] migration/qemu-file: Define g_autoptr() cleanup function for QEMUFile
Posted by Peter Xu 1 year, 2 months ago
On Sun, Nov 17, 2024 at 08:20:18PM +0100, Maciej S. Szmigiero wrote:
> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
> 
> Automatic memory management helps avoid memory safety issues.
> 
> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu
Re: [PATCH v3 23/24] migration/qemu-file: Define g_autoptr() cleanup function for QEMUFile
Posted by Fabiano Rosas 1 year, 2 months ago
"Maciej S. Szmigiero" <mail@maciej.szmigiero.name> writes:

> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
>
> Automatic memory management helps avoid memory safety issues.
>
> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
> ---
>  migration/qemu-file.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/migration/qemu-file.h b/migration/qemu-file.h
> index 11c2120edd72..fdf21324df07 100644
> --- a/migration/qemu-file.h
> +++ b/migration/qemu-file.h
> @@ -33,6 +33,8 @@ QEMUFile *qemu_file_new_input(QIOChannel *ioc);
>  QEMUFile *qemu_file_new_output(QIOChannel *ioc);
>  int qemu_fclose(QEMUFile *f);
>  
> +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QEMUFile, qemu_fclose)
> +
>  /*
>   * qemu_file_transferred:
>   *

Reviewed-by: Fabiano Rosas <farosas@suse.de>