]> granicus.if.org Git - json-c/commitdiff
Fix a memory leak in the test_printbuf test.
authorEric Haszlakiewicz <erh+git@nimenees.com>
Thu, 29 Nov 2012 19:29:55 +0000 (13:29 -0600)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Thu, 29 Nov 2012 19:29:55 +0000 (13:29 -0600)
tests/test_printbuf.c

index 9a465669d0644003d04a9c03a2d40abcf9399af7..fed185e1e779ba01d5575e71c78c209a848619a5 100644 (file)
@@ -124,6 +124,7 @@ static void test_sprintbuf(int before_resize)
        memset(data, 'X', before_resize + 1 + 1);
        data[before_resize + 1] = '\0';
        sprintbuf(pb, "%s", data);
+       free(data);
        printf("sprintbuf to just after resize(%d+1): %d, [%s], strlen(buf)=%d\n", before_resize, printbuf_length(pb), pb->buf, (int)strlen(pb->buf));
 
        printbuf_reset(pb);