The unified diff between revisions [83b5270b..] and [5587f68e..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'sqlite/alter.c'

#
#
# patch "sqlite/alter.c"
#  from [03041f2464e22532601254f87cb49997fa21dcdf]
#    to [26d755f2143719dd3f5b8aaf6cbe3c7f95332528]
#
============================================================
--- sqlite/alter.c	03041f2464e22532601254f87cb49997fa21dcdf
+++ sqlite/alter.c	26d755f2143719dd3f5b8aaf6cbe3c7f95332528
@@ -12,7 +12,7 @@
 ** This file contains C code routines that used to generate VDBE code
 ** that implements the ALTER TABLE command.
 **
-** $Id: alter.c,v 1.7 2005/06/06 21:19:57 drh Exp $
+** $Id: alter.c,v 1.8 2005/08/19 19:14:13 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -258,6 +258,7 @@ void sqlite3AlterRenameTable(
   char *zWhere = 0;         /* Where clause to locate temp triggers */
 #endif

+  if( sqlite3_malloc_failed ) goto exit_rename_table;
   assert( pSrc->nSrc==1 );

   pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase);
@@ -500,8 +501,10 @@ void sqlite3AlterBeginAddColumn(Parse *p
   int i;
   int nAlloc;

+
   /* Look up the table being altered. */
-  assert( !pParse->pNewTable );
+  assert( pParse->pNewTable==0 );
+  if( sqlite3_malloc_failed ) goto exit_begin_add_column;
   pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase);
   if( !pTab ) goto exit_begin_add_column;

@@ -520,6 +523,7 @@ void sqlite3AlterBeginAddColumn(Parse *p
   pNew = (Table *)sqliteMalloc(sizeof(Table));
   if( !pNew ) goto exit_begin_add_column;
   pParse->pNewTable = pNew;
+  pNew->nRef = 1;
   pNew->nCol = pTab->nCol;
   assert( pNew->nCol>0 );
   nAlloc = (((pNew->nCol-1)/8)*8)+8;