summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/util.h b/util.h
index 96abc51..372cd4d 100644
--- a/util.h
+++ b/util.h
@@ -25,6 +25,15 @@
if (result != ISC_R_SUCCESS) goto cleanup; \
} while (0)
+#define CHECKED_MEM_ALLOCATE(m, target_ptr, s) \
+ do { \
+ (target_ptr) = isc_mem_allocate((m), (s)); \
+ if ((target_ptr) == NULL) { \
+ result = ISC_R_NOMEMORY; \
+ goto cleanup; \
+ } \
+ } while (0)
+
#define CHECKED_MEM_GET(m, target_ptr, s) \
do { \
(target_ptr) = isc_mem_get((m), (s)); \