Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a memory leak in ALTER TABLE. (CVS 2149) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ba71716ce21ae99b10b2d0b610924978 |
User & Date: | danielk1977 2004-11-23 16:31:17.000 |
Context
2004-11-23
| ||
22:16 | fulltest runs now, but still finds a memory leak. (CVS 2150) (check-in: 5944d51e6c user: drh tags: trunk) | |
16:31 | Fix a memory leak in ALTER TABLE. (CVS 2149) (check-in: ba71716ce2 user: danielk1977 tags: trunk) | |
15:41 | Add authorization callbacks for REINDEX. (CVS 2148) (check-in: 9f0d744ee4 user: danielk1977 tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** ** $Id: build.c,v 1.288 2004/11/23 16:31:17 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** This routine is called when a new SQL statement is beginning to ** be parsed. Check to see if the schema for the database needs |
︙ | ︙ | |||
2952 2953 2954 2955 2956 2957 2958 | #ifndef SQLITE_OMIT_TRIGGER char *zTempTrig = 0; /* Where clause to locate temp triggers */ #endif assert( pSrc->nSrc==1 ); pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); | | | | < | < | < | < | < | 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 | #ifndef SQLITE_OMIT_TRIGGER char *zTempTrig = 0; /* Where clause to locate temp triggers */ #endif assert( pSrc->nSrc==1 ); pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); if( !pTab ) goto exit_alter_table; iDb = pTab->iDb; zDb = db->aDb[iDb].zName; /* Get a NULL terminated version of the new table name. */ zName = sqlite3NameFromToken(pName); if( !zName ) goto exit_alter_table; /* Check that a table or index named 'zName' does not already exist ** in database iDb. If so, this is an error. */ if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){ sqlite3ErrorMsg(pParse, "there is already another table or index with this name: %s", zName); goto exit_alter_table; } /* Make sure it is not a system table being altered, or a reserved name ** that the table is being renamed to. */ if( strlen(pTab->zName)>6 && 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) ){ sqlite3ErrorMsg(pParse, "table %s may not be altered", pTab->zName); goto exit_alter_table; } if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto exit_alter_table; } #ifndef SQLITE_OMIT_AUTHORIZATION /* Invoke the authorization callback. */ if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ goto exit_alter_table; } #endif /* Begin a transaction and code the VerifyCookie for database iDb. ** Then modify the schema cookie (since the ALTER TABLE modifies the ** schema). */ v = sqlite3GetVdbe(pParse); if( v==0 ){ goto exit_alter_table; } sqlite3BeginWriteOperation(pParse, 0, iDb); sqlite3ChangeCookie(db, v, iDb); /* Modify the sqlite_master table to use the new table name. */ sqlite3NestedParse(pParse, "UPDATE %Q.%s SET " |
︙ | ︙ | |||
3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 | sqlite3VdbeOp3(v, OP_ParseSchema, 1, 0, zTempTrig, P3_DYNAMIC); } }else{ sqliteFree(zTempTrig); #endif } sqliteFree(zName); } #endif | > > | 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 | sqlite3VdbeOp3(v, OP_ParseSchema, 1, 0, zTempTrig, P3_DYNAMIC); } }else{ sqliteFree(zTempTrig); #endif } exit_alter_table: sqlite3SrcListDelete(pSrc); sqliteFree(zName); } #endif |