olsr: clean up invocation of olsr_exit
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 5 Nov 2015 23:14:15 +0000 (00:14 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 6 Nov 2015 15:26:23 +0000 (16:26 +0100)
olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/olsr.c

index a16d063..d59daae 100644 (file)
@@ -596,10 +596,9 @@ olsr_malloc(size_t size, const char *id)
   ptr = calloc(1, size);
 
   if (!ptr) {
-    const char *const err_msg = strerror(errno);
-    OLSR_PRINTF(1, "OUT OF MEMORY: %s\n", err_msg);
-    olsr_syslog(OLSR_LOG_ERR, "olsrd: out of memory!: %s\n", err_msg);
-    olsr_exit(id, EXIT_FAILURE);
+    char buf[1024];
+    snprintf(buf, sizeof(buf), "%s: out of memory!: %s\n", id, strerror(errno));
+    olsr_exit(buf, EXIT_FAILURE);
   }
 
   return ptr;