Merge branch 'development'
[NeonServV5.git] / src / timeq.c
index c95068ddaf0ea128c4ff108f4ee07fc5a703c975..ec9ea3e4017803440e5c5c63637e9b8aaa7ffbab 100644 (file)
@@ -18,6 +18,7 @@
 #include "timeq.h"
 #include "IOHandler.h"
 #include "tools.h"
+#include "log.h"
 
 static struct timeq_entry *timeq_events;
 #ifdef HAVE_THREADS
@@ -29,6 +30,10 @@ static IOHANDLER_CALLBACK(timeq_callback) {
     struct timeq_entry *entry = event->iofd->data;
     switch(event->type) {
     case IOEVENT_TIMEOUT:
+        if(entry->name) {
+            free(entry->name);
+            entry->name = NULL;
+        }
         entry->callback(entry->data);
         entry->iofd = NULL;
         timeq_del(entry);
@@ -47,7 +52,7 @@ struct timeq_entry* timeq_uadd(int useconds, int module_id, timeq_callback_t *ca
     struct timeq_entry *entry = malloc(sizeof(*entry));
     if (!entry)
     {
-        perror("malloc() failed");
+        printf_log("main", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
         return NULL;
     }
     #ifdef HAVE_THREADS