summaryrefslogtreecommitdiff
path: root/lib/mem.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mem.h')
-rw-r--r--lib/mem.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/mem.h b/lib/mem.h
new file mode 100644
index 0000000..86cdfb5
--- /dev/null
+++ b/lib/mem.h
@@ -0,0 +1,22 @@
+#ifndef MEM_H
+# define MEM_H
+
+/* Use _asn1_afree() when calling alloca, or
+ * memory leaks may occur in systems which do not
+ * support alloca.
+ */
+#ifdef HAVE_ALLOCA
+# define _asn1_alloca alloca
+# define _asn1_afree(x)
+#else
+# define _asn1_alloca _asn1_malloc
+# define _asn1_afree _asn1_free
+#endif /* HAVE_ALLOCA */
+
+#define _asn1_malloc malloc
+#define _asn1_free free
+#define _asn1_calloc calloc
+#define _asn1_realloc realloc
+#define _asn1_strdup strdup
+
+#endif /* MEM_H */