aboutsummaryrefslogtreecommitdiffstats
path: root/free_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'free_error.c')
-rw-r--r--free_error.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/free_error.c b/free_error.c
new file mode 100644
index 0000000..a15d36c
--- /dev/null
+++ b/free_error.c
@@ -0,0 +1,15 @@
+/* See LICENSE file for copyright and license details. */
+#include "internal.h"
+
+
+void
+liberror_free_error(struct liberror_error *error)
+{
+ if (!error)
+ return;
+ if (error->backtrace && !--error->backtrace->refcount)
+ free(error->backtrace);
+ liberror_free_error(error->cause);
+ if (error->dynamically_allocated)
+ free(error);
+}