Introduce a convenient macro, that works for qemu_memalign() like g_autofree works with g_malloc.
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> --- include/qemu/osdep.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 236a045671..844658a764 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -366,6 +366,8 @@ void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared); void qemu_vfree(void *ptr); void qemu_anon_ram_free(void *ptr, size_t size); +#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_vfree))) + #define QEMU_MADV_INVALID -1 #if defined(CONFIG_MADVISE) -- 2.29.2
