From 3cc636eda67c9dd416e584e21ccb9031d44dcbd0 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 4 Nov 2014 14:27:22 +0100 Subject: 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 --- src/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index 96ff4192..88708e78 100644 --- a/src/utils.c +++ b/src/utils.c @@ -18,9 +18,9 @@ #include #include -void __noreturn memory_allocation_error(void) +void __noreturn __memory_allocation_error(const char *filename, uint32_t line) { - fprintf(stderr, "Memory allocation failure\n"); + fprintf(stderr, "%s:%u: Memory allocation failure\n", filename, line); exit(NFT_EXIT_NOMEM); } -- cgit v1.2.3