Browse Source

ttxml: zero terminate the buffer after checking it was allocated

Daniel Burke 14 years ago
parent
commit
ce859a2e6a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ccan/ttxml/ttxml.c

+ 2 - 2
ccan/ttxml/ttxml.c

@@ -337,10 +337,10 @@ XmlNode* xml_load(const char * filename)
 		return NULL;
 
 	xml.buf = malloc(BUFFER+1);
-	xml.buf[BUFFER]=0;
-	xml.len = BUFFER;
 	if(!xml.buf)
 		goto xml_load_fail_malloc_buf;
+	xml.buf[BUFFER]=0;
+	xml.len = BUFFER;
 	
 	xml_read_file(&xml);