had to fix generation and rebuild. the testapi found a bug in the last

* gentest.py testapi.c: had to fix generation and rebuild.
* valid.c: the testapi found a bug in the last code of course !
Daniel
diff --git a/ChangeLog b/ChangeLog
index b89316f..e48505a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jan 26 01:03:37 CET 2005 Daniel Veillard <daniel@veillard.com>
+
+	* gentest.py testapi.c: had to fix generation and rebuild.
+	* valid.c: the testapi found a bug in the last code of course !
+
 Wed Jan 26 00:43:05 CET 2005 Daniel Veillard <daniel@veillard.com>
 
 	* Makefile.am testapi.c doc/Makefile.am: fixing the way testapi.c
diff --git a/gentest.py b/gentest.py
index 12dd718..c8e675d 100755
--- a/gentest.py
+++ b/gentest.py
@@ -231,6 +231,8 @@
               (ret_val != prefix) && (ret_val != memory))
               xmlFree(ret_val);
 	  ret_val = NULL;""",
+   "xmlNewDocElementContent":
+       """xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""",
    "xmlDictReference": "xmlDictFree(dict);",
    # Functions which deallocates one of their parameters
    "xmlXPathConvertBoolean": """val = NULL;""",
diff --git a/testapi.c b/testapi.c
index 2dd0098..bf829dc 100644
--- a/testapi.c
+++ b/testapi.c
@@ -24401,6 +24401,7 @@
         type = gen_xmlElementContentType(n_type, 2);
 
         ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
+        xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
         desret_xmlElementContentPtr(ret_val);
         call_tests++;
         des_xmlDocPtr(n_doc, doc, 0);
diff --git a/valid.c b/valid.c
index 5abdc92..e73bd65 100644
--- a/valid.c
+++ b/valid.c
@@ -1547,8 +1547,9 @@
      * and flag it by setting a special parent value
      * so the parser doesn't unallocate it.
      */
-    if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
-        (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
+    if ((ctxt != NULL) &&
+        ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
+         (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1))) {
 	ret->content = content;
 	if (content != NULL)
 	    content->parent = (xmlElementContentPtr) 1;