Two formats and a memory leak.

Signed-off by: Rosen Penev <ros...@gmail.com>
---
 ulog.c  | 2 +-
 usock.c | 2 +-
 utils.c | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ulog.c b/ulog.c
index 985d366..e7fb081 100644
--- a/ulog.c
+++ b/ulog.c
@@ -91,7 +91,7 @@ static void ulog_kmsg(int priority, const char *fmt, va_list 
ap)
        FILE *kmsg;
 
        if ((kmsg = fopen("/dev/kmsg", "r+")) != NULL) {
-               fprintf(kmsg, "<%u>", priority);
+               fprintf(kmsg, "<%d>", priority);
 
                if (_ulog_ident)
                        fprintf(kmsg, "%s: ", _ulog_ident);
diff --git a/usock.c b/usock.c
index 0ce5390..0983806 100644
--- a/usock.c
+++ b/usock.c
@@ -247,7 +247,7 @@ const char *usock_port(int port)
        if (port < 0 || port > 65535)
                return NULL;
 
-       snprintf(buffer, sizeof(buffer), "%u", port);
+       snprintf(buffer, sizeof(buffer), "%d", port);
 
        return buffer;
 }
diff --git a/utils.c b/utils.c
index 91dd71e..627b0f6 100644
--- a/utils.c
+++ b/utils.c
@@ -43,8 +43,10 @@ void *__calloc_a(size_t len, ...)
        va_end(ap1);
 
        ptr = calloc(1, alloc_len);
-       if (!ptr)
+       if (!ptr) {
+               va_end(ap);
                return NULL;
+       }
        alloc_len = 0;
        foreach_arg(ap, cur_addr, cur_len, &ret, len) {
                *cur_addr = &ptr[alloc_len];
-- 
2.8.3


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to