path: root/include
diff options
authorPablo Neira Ayuso <>2014-11-04 14:27:22 +0100
committerPablo Neira Ayuso <>2014-11-04 17:34:26 +0100
commit3cc636eda67c9dd416e584e21ccb9031d44dcbd0 (patch)
treebc2e4c7e222add76083c864f05af7b1d9f07e0c0 /include
parenta7469ab47400bf4add8269a2908965e82ceefc48 (diff)
utils: indicate file and line on memory allocation errors
For example: src/netlink.c:179: Memory allocation failure This shouldn't happen, so this allows us to identify at what point the memory allocation failure has happened. It may be helpful to identify bugs. Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'include')
1 files changed, 4 insertions, 1 deletions
diff --git a/include/utils.h b/include/utils.h
index cc5948c1..15b2e393 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -76,7 +76,10 @@
(void) (&_max1 == &_max2); \
_max1 > _max2 ? _max1 : _max2; })
-extern void memory_allocation_error(void) __noreturn;
+extern void __memory_allocation_error(const char *filename, uint32_t line) __noreturn;
+#define memory_allocation_error() \
+ __memory_allocation_error(__FILE__, __LINE__);
extern void xfree(const void *ptr);
extern void *xmalloc(size_t size);