blob: 909772f038cb71498bdf901f6a5e6924d14a7b58 [file] [log] [blame]
Harald Weltefa034002010-07-18 23:15:24 +02001diff --git a/include/asn1c/asn_internal.h b/include/asn1c/asn_internal.h
2index 67f055a..45b1adb 100644
3--- a/include/asn1c/asn_internal.h
4+++ b/include/asn1c/asn_internal.h
5@@ -15,6 +15,8 @@
6 #include <assert.h> /* for assert() macro */
7 #endif
8
9+#include <osmocore/talloc.h>
10+
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14@@ -23,10 +25,12 @@ extern "C" {
15 #define ASN1C_ENVIRONMENT_VERSION 920 /* Compile-time version */
16 int get_asn1c_environment_version(void); /* Run-time version */
17
18-#define CALLOC(nmemb, size) calloc(nmemb, size)
19-#define MALLOC(size) malloc(size)
20-#define REALLOC(oldptr, size) realloc(oldptr, size)
21-#define FREEMEM(ptr) free(ptr)
22+extern void *talloc_asn1_ctx;
23+
Harald Welte6264d3d2010-07-18 23:30:11 +020024+#define CALLOC(nmemb, size) talloc_zero_size(talloc_asn1_ctx, (nmemb) * (size))
Harald Weltefa034002010-07-18 23:15:24 +020025+#define MALLOC(size) talloc_size(talloc_asn1_ctx, size)
26+#define REALLOC(oldptr, size) talloc_realloc_size(talloc_asn1_ctx, oldptr, size)
27+#define FREEMEM(ptr) talloc_free(ptr)
28
29 /*
30 * A macro for debugging the ASN.1 internals.