aboutsummaryrefslogtreecommitdiffstats
path: root/free_error.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-04-12 21:12:12 +0200
committerMattias Andrée <maandree@kth.se>2019-04-12 21:13:19 +0200
commit1484b1264552ad05d75a4ca4f40972ac94e729e9 (patch)
treeb9f6d6212866699db66e8bd64310d445498db2f3 /free_error.c
downloadliberror-1484b1264552ad05d75a4ca4f40972ac94e729e9.tar.gz
liberror-1484b1264552ad05d75a4ca4f40972ac94e729e9.tar.bz2
liberror-1484b1264552ad05d75a4ca4f40972ac94e729e9.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-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);
+}