fix an XML Schemas crash raised by Stefan Behnel when testing with W3C

* xmlschemas.c: fix an XML Schemas crash raised by Stefan Behnel
  when testing with W3C test suite
Daniel

svn path=/trunk/; revision=3712
diff --git a/ChangeLog b/ChangeLog
index 3f8fa4c..d5b23cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 24 15:04:54 CET 2008 Daniel Veillard <daniel@veillard.com>
+
+	* xmlschemas.c: fix an XML Schemas crash raised by Stefan Behnel
+	  when testing with W3C test suite
+
 Mon Mar 24 12:12:00 CET 2008 Daniel Veillard <daniel@veillard.com>
 
 	* threads.c: check some allocation with Ashwin patch
diff --git a/xmlschemas.c b/xmlschemas.c
index 13c22ca..01a9c3c 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -21808,9 +21808,9 @@
 		return (1);
 	    }
 	    if (xmlSchemaGetNotation(schema, localName, nsName) != NULL) {
-		if (valNeeded && (val != NULL)) {
-		    (*val) = xmlSchemaNewNOTATIONValue(BAD_CAST localName,
-			BAD_CAST xmlStrdup(nsName));
+		if ((valNeeded) && (val != NULL)) {
+		    (*val) = xmlSchemaNewNOTATIONValue(xmlStrdup(localName),
+						       xmlStrdup(nsName));
 		    if (*val == NULL)
 			ret = -1;
 		}