]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Erik Hovland (3):
authorChristopher Watford <christopher.watford@gmail.com>
Wed, 8 Jul 2009 03:46:10 +0000 (03:46 +0000)
committerChristopher Watford <christopher.watford@gmail.com>
Wed, 8 Jul 2009 03:46:10 +0000 (03:46 +0000)
      Fix any noticeable spelling or grammar errors.
      Make sure every va_start has a va_end.
      Check all pointers for validity.

git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@41 327403b1-1117-474d-bef2-5cb71233fd97

ChangeLog
json_tokener.c
printbuf.c

index 6065747ee728b7e96836e07fc10e320e6346d09f..6f956f0cf2425213e03ba04a1861be2ea0d92260 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
 0.9
+  * Fix any noticeable spelling or grammar errors.
+  * Make sure every va_start has a va_end.
+  * Check all pointers for validity.
+    Erik Hovland, erik at hovland dot org
   * Fix json_object_get_boolean to return false for empty string
     Spotted by Vitaly Kruglikov, Vitaly dot Kruglikov at palm dot com
   * optimizations to json_tokener_parse_ex(), printbuf_memappend()
index 8e8c6d9de3db315f240c1dee79ff62a52739b8a2..a1951b9018b3f0e90ac72190aa93d5472ec8ff66 100644 (file)
@@ -64,6 +64,7 @@ struct json_tokener* json_tokener_new(void)
   struct json_tokener *tok;
 
   tok = (struct json_tokener*)calloc(1, sizeof(struct json_tokener));
+  if (!tok) return NULL;
   tok->pb = printbuf_new();
   json_tokener_reset(tok);
   return tok;
index a9c711cebad0c4eecb8eceffbbc18f4032445c65..a809aa9afaa8ff624dd3e41c4c6f49baafc2db98 100644 (file)
@@ -120,10 +120,10 @@ int sprintbuf(struct printbuf *p, const char *msg, ...)
   /* if string is greater than stack buffer, then use dynamic string
      with vasprintf.  Note: some implementation of vsnprintf return -1
      if output is truncated whereas some return the number of bytes that
-     would have been writen - this code handles both cases. */
+     would have been written - this code handles both cases. */
   if(size == -1 || size > 127) {
     va_start(ap, msg);
-    if((size = vasprintf(&t, msg, ap)) == -1) return -1;
+    if((size = vasprintf(&t, msg, ap)) == -1) { va_end(ap); return -1; }
     va_end(ap);
     printbuf_memappend(p, t, size);
     free(t);