summary refs log tree commit diff stats
path: root/include/qapi/error.h
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2025-03-04 23:03:35 +0100
committerCédric Le Goater <clg@redhat.com>2025-03-06 06:47:33 +0100
commit18eb55546a54e443d94a4c49286348176ad4b00a (patch)
treeaae981fcd91eb3510a83d4456baee0519814cb5e /include/qapi/error.h
parent6a76eb4872f632974307bf12cb7f2416a77ad4a8 (diff)
downloadfocaccia-qemu-18eb55546a54e443d94a4c49286348176ad4b00a.tar.gz
focaccia-qemu-18eb55546a54e443d94a4c49286348176ad4b00a.zip
error: define g_autoptr() cleanup function for the Error type
Automatic memory management helps avoid memory safety issues.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Link: https://lore.kernel.org/qemu-devel/a5843c5fa64d7e5239a4316092ec0ef0d10c2320.1741124640.git.maciej.szmigiero@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'include/qapi/error.h')
-rw-r--r--include/qapi/error.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/qapi/error.h b/include/qapi/error.h
index f5fe216262..41e3816380 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -437,6 +437,8 @@ Error *error_copy(const Error *err);
  */
 void error_free(Error *err);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Error, error_free)
+
 /*
  * Convenience function to assert that *@errp is set, then silently free it.
  */