shithub: riscv

Download patch

ref: 86e0099835f99de6ccc3bee33a297387993aa037
parent: b8986a889d7e3a445c0265c5cfb3b1db385db756
parent: d8d47f14b5ed8f6d3f892761ed86c6ce2075c337
author: ben <ben@rana>
date: Wed Apr 27 04:20:54 EDT 2016

merge in master

--- a/sys/src/libjson/json.c
+++ b/sys/src/libjson/json.c
@@ -323,7 +323,7 @@
 	memset(&l, 0, sizeof(l));
 	l.s = s;
 	l.slen = strlen(s);
-	if((l.buf = mallocz(l.slen+1, 1)) == nil)
+	if((l.buf = mallocz(l.slen+UTFmax+1, 1)) == nil)
 		return nil;
 
 	j = jsonobj(&l);
@@ -336,6 +336,8 @@
 {
 	JSONEl *e, *f;
 
+	if(j == nil)
+		return;
 	switch(j->t){
 	case JSONString:
 		if(j->s)