syslog: remove unnecessary sizeof struct between messages
[project/ubox.git] / log / syslog.c
index a596b48..856fa60 100644 (file)
@@ -51,7 +51,7 @@ static regex_t pat_tstamp;
 static struct log_head*
 log_next(struct log_head *h, int size)
 {
-       struct log_head *n = (struct log_head *) &h->data[PAD(sizeof(struct log_head) + size)];
+       struct log_head *n = (struct log_head *) &h->data[PAD(size)];
 
        return (n >= log_end) ? (log) : (n);
 }
@@ -66,7 +66,7 @@ log_add(char *buf, int size, int source)
 
        /* bounce out if we don't have init'ed yet (regmatch etc will blow) */
        if (!log) {
-               fprintf(stderr, buf);
+               fprintf(stderr, "%s", buf);
                return;
        }
 
@@ -300,4 +300,6 @@ log_shutdown(void)
        close(slog.fd.fd);
        close(klog.fd.fd);
        free(log);
+       regfree(&pat_prio);
+       regfree(&pat_tstamp);
 }