Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Memory leak fixes for tests in file select1.test. (CVS 1599) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
59db58ebd30cd7c79c32f5a725620e74 |
User & Date: | danielk1977 2004-06-15 13:36:30.000 |
Context
2004-06-15
| ||
16:51 | Assorted memory leak fixes. (CVS 1600) (check-in: 07b90f3690 user: danielk1977 tags: trunk) | |
13:36 | Memory leak fixes for tests in file select1.test. (CVS 1599) (check-in: 59db58ebd3 user: danielk1977 tags: trunk) | |
11:40 | Minor bugfixes and test case adjustments for version 2 test cases to work with version 3. (CVS 1598) (check-in: e21a181376 user: danielk1977 tags: trunk) | |
Changes
Changes to src/func.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** ** $Id: func.c,v 1.69 2004/06/15 13:36:30 danielk1977 Exp $ */ #include <ctype.h> #include <math.h> #include <stdlib.h> #include <assert.h> #include "sqliteInt.h" #include "vdbeInt.h" |
︙ | ︙ | |||
927 928 929 930 931 932 933 934 935 936 937 938 939 940 | } static void minMaxFinalize(sqlite3_context *context){ sqlite3_value *pRes; pRes = (sqlite3_value *)sqlite3_aggregate_context(context, sizeof(Mem)); if( pRes->flags ){ sqlite3_result_value(context, pRes); } } /* ** This function registered all of the above C functions as SQL ** functions. This should be the only routine in this file with ** external linkage. */ | > | 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | } static void minMaxFinalize(sqlite3_context *context){ sqlite3_value *pRes; pRes = (sqlite3_value *)sqlite3_aggregate_context(context, sizeof(Mem)); if( pRes->flags ){ sqlite3_result_value(context, pRes); } sqlite3VdbeMemRelease(pRes); } /* ** This function registered all of the above C functions as SQL ** functions. This should be the only routine in this file with ** external linkage. */ |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.221 2004/06/15 13:36:31 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** A pointer to this structure is used to communicate information |
︙ | ︙ | |||
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | prepare_out: if( sqlite3SafetyOff(db) ){ rc = SQLITE_MISUSE; } if( zErrMsg ){ sqlite3Error(db, rc, "%s", zErrMsg); }else{ sqlite3Error(db, rc, 0); } return rc; } /* | > | 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | prepare_out: if( sqlite3SafetyOff(db) ){ rc = SQLITE_MISUSE; } if( zErrMsg ){ sqlite3Error(db, rc, "%s", zErrMsg); sqliteFree(zErrMsg); }else{ sqlite3Error(db, rc, 0); } return rc; } /* |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.374 2004/06/15 13:36:37 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
989 990 991 992 993 994 995 | assert( pTo->z==pTos->zShort ); pTo->z = pTo->zShort; } pTos--; break; } | < < < < < < < < < < < < < < < < < < < < < | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | assert( pTo->z==pTos->zShort ); pTo->z = pTo->zShort; } pTos--; break; } /* Opcode: Callback P1 * * ** ** Pop P1 values off the stack and form them into an array. Then ** invoke the callback function using the newly formed array as the ** 3rd parameter. */ case OP_Callback: { |
︙ | ︙ |
Changes to src/vdbeInt.h.
︙ | ︙ | |||
299 300 301 302 303 304 305 | int nLabel; /* Number of labels used */ int nLabelAlloc; /* Number of slots allocated in aLabel[] */ int *aLabel; /* Space to hold the labels */ Mem *aStack; /* The operand stack, except string values */ Mem *pTos; /* Top entry in the operand stack */ Mem **apArg; /* Arguments to currently executing user function */ Mem *aColName; /* Column names to return */ | < < | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | int nLabel; /* Number of labels used */ int nLabelAlloc; /* Number of slots allocated in aLabel[] */ int *aLabel; /* Space to hold the labels */ Mem *aStack; /* The operand stack, except string values */ Mem *pTos; /* Top entry in the operand stack */ Mem **apArg; /* Arguments to currently executing user function */ Mem *aColName; /* Column names to return */ int nCursor; /* Number of slots in apCsr[] */ Cursor **apCsr; /* One element of this array for each open cursor */ Sorter *pSort; /* A linked list of objects to be sorted */ FILE *pFile; /* At most one open file handler */ int nField; /* Number of file fields */ char **azField; /* Data for each file field */ int nVar; /* Number of entries in apVar[] */ |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
526 527 528 529 530 531 532 | */ int sqlite3VdbeList( Vdbe *p /* The VDBE */ ){ sqlite *db = p->db; int i; int rc = SQLITE_OK; | < < < < < < < | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | */ int sqlite3VdbeList( Vdbe *p /* The VDBE */ ){ sqlite *db = p->db; int i; int rc = SQLITE_OK; assert( p->explain ); /* Even though this opcode does not put dynamic strings onto the ** the stack, they may become dynamic if the user calls ** sqlite3_column_text16(), causing a translation to UTF-16 encoding. */ if( p->pTos==&p->aStack[4] ){ for(i=0; i<5; i++){ sqlite3VdbeMemRelease(&p->aStack[i]); p->aStack[i].flags = 0; } } p->resOnStack = 0; i = p->pc++; if( i>=p->nOp ){ p->rc = SQLITE_OK; rc = SQLITE_DONE; }else if( db->flags & SQLITE_Interrupt ){ |
︙ | ︙ | |||
634 635 636 637 638 639 640 | ** Allocation all the stack space we will ever need. */ if( p->aStack==0 ){ p->nVar = nVar; assert( nVar>=0 ); n = isExplain ? 10 : p->nOp; p->aStack = sqliteMalloc( | | < | | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | ** Allocation all the stack space we will ever need. */ if( p->aStack==0 ){ p->nVar = nVar; assert( nVar>=0 ); n = isExplain ? 10 : p->nOp; p->aStack = sqliteMalloc( n*(sizeof(p->aStack[0])+sizeof(Mem*)) /* aStack, apArg */ + p->nVar*sizeof(Mem) /* apVar */ ); p->apArg = (Mem **)&p->aStack[n]; p->apVar = (Mem *)&p->apArg[n]; for(n=0; n<p->nVar; n++){ p->apVar[n].flags = MEM_Null; } } #ifdef SQLITE_DEBUG if( (p->db->flags & SQLITE_VdbeListing)!=0 |
︙ | ︙ | |||
1378 1379 1380 1381 1382 1383 1384 | #ifndef NDEBUG sqliteFree(pOp->zComment); #endif } for(i=0; i<p->nVar; i++){ sqlite3VdbeMemRelease(&p->apVar[i]); } | < < < < < < > > > > > > | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | #ifndef NDEBUG sqliteFree(pOp->zComment); #endif } for(i=0; i<p->nVar; i++){ sqlite3VdbeMemRelease(&p->apVar[i]); } sqliteFree(p->aOp); sqliteFree(p->aLabel); sqliteFree(p->aStack); if( p->aColName ){ for(i=0; i<(p->nResColumn)*2; i++){ sqlite3VdbeMemRelease(&(p->aColName[i])); } sqliteFree(p->aColName); } p->magic = VDBE_MAGIC_DEAD; sqliteFree(p); } /* ** If a MoveTo operation is pending on the given cursor, then do that ** MoveTo now. Return an error code. If no MoveTo is pending, this |
︙ | ︙ |