utils: prefer using gccs builtin swapping functions which support constant folding
[project/libubox.git] / blobmsg_json.c
index d4f68465512b2fccc92c0c415049b4458ed947ee..f16635834fb9ccc53ba76515dd08e4f04ab4e2f2 100644 (file)
@@ -108,7 +108,7 @@ static bool blobmsg_puts(struct strbuf *s, const char *c, int len)
                return true;
 
        if (s->pos + len >= s->len) {
-               s->len += 16;
+               s->len += 16 + len;
                s->buf = realloc(s->buf, s->len);
                if (!s->buf)
                        return false;