Assorted memory leak fixes. (CVS 1600)

FossilOrigin-Name: 07b90f3690768e852384fbbde0ba59e69e24d1da
diff --git a/src/expr.c b/src/expr.c
index 4540164..d43eb0d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.141 2004/06/12 09:25:14 danielk1977 Exp $
+** $Id: expr.c,v 1.142 2004/06/15 16:51:01 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -307,7 +307,10 @@
   if( pNew==0 ) return 0;
   pNew->nExpr = pNew->nAlloc = p->nExpr;
   pNew->a = pItem = sqliteMalloc( p->nExpr*sizeof(p->a[0]) );
-  if( pItem==0 ) return 0;  /* Leaks memory after a malloc failure */
+  if( pItem==0 ){
+    sqliteFree(pNew);
+    return 0;
+  } 
   for(i=0; i<p->nExpr; i++, pItem++){
     Expr *pNewExpr, *pOldExpr;
     pItem->pExpr = pNewExpr = sqlite3ExprDup(pOldExpr = p->a[i].pExpr);