diff --git a/ChangeLog b/ChangeLog
index a98cc4fa53113bf408561d7954e6ca674e3180ae_Q2hhbmdlTG9n..749151840cdc75e984ce19b7e195c73ecb8ec468_Q2hhbmdlTG9n 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Wed Jan 24 11:05:28 PST 2007 William Brack <wbrack@mmm.com.hk>
+
+	* libxslt/pattern.c: added check for memory allocation error
+	  (bug #400242); fixed "type-punned pointer" warnings.
+	* libxslt/xsltutils.c: added checks for memory allocation error
+	  (bug #400242)
+	* restored NEWS, doc/EXSLT/downloads.html which mysteriously
+	  disappeared from svn
+	
 Wed Jan 17 14:20:18 CET 2007 Daniel Veillard <daniel@veillard.com>
 
 	* configure.in doc/*: preparing release of 1.1.20
diff --git a/NEWS b/NEWS
index a98cc4fa53113bf408561d7954e6ca674e3180ae_TkVXUw==..749151840cdc75e984ce19b7e195c73ecb8ec468_TkVXUw== 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,18 @@
 to the CVS at 
 http://cvs.gnome.org/viewcvs/libxslt/
  code base.Those are the public releases made:
+1.1.20: Jan 17 2007:
+   - Portability fixes: strict aliasing fix (Marcus Meissner), BSD portability
+      patches (Roland Illig)
+   - Bug fixes: Result Value Tree handling fix (William Brack), function
+      parameters fix (William), uninitialized variable (Kjartan Maraas),
+      empty text node handling (William), plugin support and test fixes (William),
+      fragment support fixes (William)
+   - Improvements: python stylesheet compare and transform context
+      access (Nic Ferrier), EXSLT string replace support (Joel Reed),
+      xsltproc better low level error handling (Mike Hommey and William)
+
+
 1.1.19: Nov 29 2006:
    - Bug fixes: entities within attributes (William Brack), Python detection
       problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result
diff --git a/doc/EXSLT/downloads.html b/doc/EXSLT/downloads.html
index a98cc4fa53113bf408561d7954e6ca674e3180ae_ZG9jL0VYU0xUL2Rvd25sb2Fkcy5odG1s..749151840cdc75e984ce19b7e195c73ecb8ec468_ZG9jL0VYU0xUL2Rvd25sb2Fkcy5odG1s 100644
--- a/doc/EXSLT/downloads.html
+++ b/doc/EXSLT/downloads.html
@@ -20,7 +20,7 @@
 <a href="mailto:Steve.Ball@zveno.com">Steve Ball</a> provides <a href="http://www.zveno.com/open_source/libxml2xslt.html">Mac Os X
 binaries</a>.</p><p><a name="Contribs" id="Contribs">Contribs:</a></p><p>I do accept external contributions, especially if compiling on another
 platform, get in touch with me to upload the package. I will keep them in the
-<a href="ftp://xmlsoft.org/contribs/">contrib directory</a></p><p>Libxslt is also available from CVS:</p><ul><li><p>The <a href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&amp;dir=libxslt">Gnome
+<a href="ftp://xmlsoft.org/contribs/">contrib directory</a></p><p>Libxslt is also available from CVS:</p><ul><li><p>The <a href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome">Gnome
     CVS base</a>. Check the <a href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a>
     page; the CVS module is <b>libxslt</b>.</p>
   </li>
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index a98cc4fa53113bf408561d7954e6ca674e3180ae_bGlieHNsdC9wYXR0ZXJuLmM=..749151840cdc75e984ce19b7e195c73ecb8ec468_bGlieHNsdC9wYXR0ZXJuLmM= 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -142,7 +142,7 @@
     cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch));
     if (cur == NULL) {
 	xsltTransformError(NULL, NULL, NULL,
-		"xsltNewCompMatch : malloc failed\n");
+		"xsltNewCompMatch : out of memory error\n");
 	return(NULL);
     }
     memset(cur, 0, sizeof(xsltCompMatch));
@@ -2066,7 +2066,12 @@
 int
 xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur,
 	        const xmlChar *mode, const xmlChar *modeURI) {
-    xsltCompMatchPtr pat, list, *top = NULL, next;
+    xsltCompMatchPtr pat, list, next;
+    /*
+     * 'top' will point to style->xxxMatch ptr - declaring as 'void'
+     *  avoids gcc 'type-punned pointer' warning.
+     */
+    void **top = NULL;
     const xmlChar *name = NULL;
     float priority;              /* the priority */
 
@@ -2076,6 +2081,8 @@
     priority = cur->priority;
     pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
 		    style, NULL, 1);
+    if (pat == NULL)
+    	return(-1);
     while (pat) {
 	next = pat->next;
 	pat->next = NULL;
@@ -2097,8 +2104,8 @@
 	    if (pat->steps[0].value != NULL)
 		name = pat->steps[0].value;
 	    else
-		top = (xsltCompMatchPtr *) &(style->attrMatch);
+		top = &(style->attrMatch);
 	    break;
         case XSLT_OP_CHILD:
         case XSLT_OP_PARENT:
         case XSLT_OP_ANCESTOR:
@@ -2101,7 +2108,7 @@
 	    break;
         case XSLT_OP_CHILD:
         case XSLT_OP_PARENT:
         case XSLT_OP_ANCESTOR:
-	    top = (xsltCompMatchPtr *) &(style->elemMatch);
+	    top = &(style->elemMatch);
 	    break;
         case XSLT_OP_ROOT:
@@ -2106,5 +2113,5 @@
 	    break;
         case XSLT_OP_ROOT:
-	    top = (xsltCompMatchPtr *) &(style->rootMatch);
+	    top = &(style->rootMatch);
 	    break;
         case XSLT_OP_KEY:
@@ -2109,8 +2116,8 @@
 	    break;
         case XSLT_OP_KEY:
-	    top = (xsltCompMatchPtr *) &(style->keyMatch);
+	    top = &(style->keyMatch);
 	    break;
         case XSLT_OP_ID:
 	    /* TODO optimize ID !!! */
         case XSLT_OP_NS:
         case XSLT_OP_ALL:
@@ -2112,9 +2119,9 @@
 	    break;
         case XSLT_OP_ID:
 	    /* TODO optimize ID !!! */
         case XSLT_OP_NS:
         case XSLT_OP_ALL:
-	    top = (xsltCompMatchPtr *) &(style->elemMatch);
+	    top = &(style->elemMatch);
 	    break;
         case XSLT_OP_END:
 	case XSLT_OP_PREDICATE:
@@ -2130,6 +2137,6 @@
 	    if (pat->steps[0].value != NULL)
 		name = pat->steps[0].value;
 	    else
-		top = (xsltCompMatchPtr *) &(style->piMatch);
+		top = &(style->piMatch);
 	    break;
 	case XSLT_OP_COMMENT:
@@ -2134,5 +2141,5 @@
 	    break;
 	case XSLT_OP_COMMENT:
-	    top = (xsltCompMatchPtr *) &(style->commentMatch);
+	    top = &(style->commentMatch);
 	    break;
 	case XSLT_OP_TEXT:
@@ -2137,9 +2144,9 @@
 	    break;
 	case XSLT_OP_TEXT:
-	    top = (xsltCompMatchPtr *) &(style->textMatch);
+	    top = &(style->textMatch);
 	    break;
         case XSLT_OP_ELEM:
 	case XSLT_OP_NODE:
 	    if (pat->steps[0].value != NULL)
 		name = pat->steps[0].value;
 	    else
@@ -2140,10 +2147,10 @@
 	    break;
         case XSLT_OP_ELEM:
 	case XSLT_OP_NODE:
 	    if (pat->steps[0].value != NULL)
 		name = pat->steps[0].value;
 	    else
-		top = (xsltCompMatchPtr *) &(style->elemMatch);
+		top = &(style->elemMatch);
 	    break;
 	}
 	if (name != NULL) {
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index a98cc4fa53113bf408561d7954e6ca674e3180ae_bGlieHNsdC94c2x0dXRpbHMuYw==..749151840cdc75e984ce19b7e195c73ecb8ec468_bGlieHNsdC94c2x0dXRpbHMuYw== 100644
--- a/libxslt/xsltutils.c
+++ b/libxslt/xsltutils.c
@@ -2098,7 +2098,7 @@
 	    xpathCtxt = XSLT_CCTXT(style)->xpathCtxt;
 	    xpathCtxt->doc = style->doc;
 	} else
-	    xpathCtxt = xmlXPathNewContext(style->doc);	
+	    xpathCtxt = xmlXPathNewContext(style->doc);
 #else
 	xpathCtxt = xmlXPathNewContext(style->doc);
 #endif
@@ -2102,6 +2102,8 @@
 #else
 	xpathCtxt = xmlXPathNewContext(style->doc);
 #endif
+	if (xpathCtxt == NULL)
+	    return NULL;
 	xpathCtxt->dict = style->dict;
     } else {
 	xpathCtxt = xmlXPathNewContext(NULL);
@@ -2105,6 +2107,8 @@
 	xpathCtxt->dict = style->dict;
     } else {
 	xpathCtxt = xmlXPathNewContext(NULL);
+	if (xpathCtxt == NULL)
+	    return NULL;
     }
     /*
     * Compile the expression.