aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/misc.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-04-08 12:04:33 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-06-07 14:35:40 +0200
commit7a2e1a0a7a575c64eaf050c8ec08e5b36e4acfad (patch)
treec3fda7a6c0202341612fd1ab489974abe2ce7e00 /lib/sqfs/misc.c
parenta49a5bc6253883f8dab06d5bae7e5453008da164 (diff)
Fix: libsquashfs: add sqfs_free() function
On systems like Windows, the dynamic library and applications can easily end up being linked against different runtime libraries, so applications cannot be expected to be able to free() any malloc'd pointer that the library returns. This commit adds an sqfs_free function so the application can pass pointers back to the library to call the correct free() implementation. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/misc.c')
-rw-r--r--lib/sqfs/misc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/sqfs/misc.c b/lib/sqfs/misc.c
new file mode 100644
index 0000000..74a4203
--- /dev/null
+++ b/lib/sqfs/misc.c
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
+/*
+ * misc.c
+ *
+ * Copyright (C) 2021 David Oberhollenzer <goliath@infraroot.at>
+ */
+#define SQFS_BUILDING_DLL
+#include "config.h"
+
+#include "sqfs/predef.h"
+
+#include <stdlib.h>
+
+void sqfs_free(void *ptr)
+{
+ free(ptr);
+}