Richard Jinks spotted an incoherent memory allocation behaviour in

* xpath.c: Richard Jinks spotted an incoherent memory allocation
  behaviour in xmlXPathCastToString()
Daniel
diff --git a/ChangeLog b/ChangeLog
index 2f0fcf0..4004754 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Mar 22 13:22:09 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+	* xpath.c: Richard Jinks spotted an incoherent memory allocation
+	  behaviour in xmlXPathCastToString()
+
 Thu Mar 21 14:25:29 CET 2002 Daniel Veillard <daniel@veillard.com>
 
 	* encoding.c: fixed a bug in the ISO-Latin 1 to UTF8 encoder
diff --git a/xpath.c b/xpath.c
index 484975c..7018ce2 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3237,7 +3237,7 @@
 	    ret = xmlXPathCastNodeSetToString(val->nodesetval);
 	    break;
 	case XPATH_STRING:
-	    return(val->stringval);
+	    return(xmlStrdup(val->stringval));
         case XPATH_BOOLEAN:
 	    ret = xmlXPathCastBooleanToString(val->boolval);
 	    break;