While common error propagation practice does not require manually free'ing of local 'Error' objects, there are some cases where this is needed. One example is where the 'Error' object is only used for providing info to a trace event probe. Supporting g_autoptr avoids the need to manually call 'error_free'.
Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> --- include/qapi/error.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/qapi/error.h b/include/qapi/error.h index 71f8fb2c50..6e429809d8 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. */ -- 2.45.2