summary refs log tree commit diff stats
path: root/util/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/error.c')
-rw-r--r--util/error.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/util/error.c b/util/error.c
index 8b86490ba1..80c89a2079 100644
--- a/util/error.c
+++ b/util/error.c
@@ -220,6 +220,13 @@ void error_free(Error *err)
     }
 }
 
+void error_free_or_abort(Error **errp)
+{
+    assert(errp && *errp);
+    error_free(*errp);
+    *errp = NULL;
+}
+
 void error_propagate(Error **dst_errp, Error *local_err)
 {
     if (!local_err) {