Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a memory leak: a failure to deallocate the P3 parameter on a call to sqlite3VdbeChangeP3. (CVS 2695) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
714254cbc12564d44548707043fdcdff |
User & Date: | drh 2005-09-16 00:27:01.000 |
Context
2005-09-16
| ||
02:38 | Fix a whole host of newly discovered memory leaks the occur after a failure of realloc(). (CVS 2696) (check-in: 4686d64975 user: drh tags: trunk) | |
00:27 | Fix a memory leak: a failure to deallocate the P3 parameter on a call to sqlite3VdbeChangeP3. (CVS 2695) (check-in: 714254cbc1 user: drh tags: trunk) | |
2005-09-15
| ||
21:24 | The table_info pragma now gives the order of columns in the primary key. (CVS 2694) (check-in: 9b60f48de7 user: drh tags: trunk) | |
Changes
Changes to src/vdbeaux.c.
︙ | ︙ | |||
64 65 66 67 68 69 70 71 | static void resizeOpArray(Vdbe *p, int N){ if( p->magic==VDBE_MAGIC_RUN ){ assert( N==p->nOp ); p->nOpAlloc = N; p->aOp = sqliteRealloc(p->aOp, N*sizeof(Op)); }else if( p->nOpAlloc<N ){ int oldSize = p->nOpAlloc; p->nOpAlloc = N+100; | > | > | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | static void resizeOpArray(Vdbe *p, int N){ if( p->magic==VDBE_MAGIC_RUN ){ assert( N==p->nOp ); p->nOpAlloc = N; p->aOp = sqliteRealloc(p->aOp, N*sizeof(Op)); }else if( p->nOpAlloc<N ){ int oldSize = p->nOpAlloc; VdbeOp *pNew; p->nOpAlloc = N+100; pNew = sqliteRealloc(p->aOp, p->nOpAlloc*sizeof(Op)); if( pNew ){ p->aOp = pNew; memset(&p->aOp[oldSize], 0, (p->nOpAlloc-oldSize)*sizeof(Op)); } } } /* ** Add a new instruction to the list of instructions current in the |
︙ | ︙ | |||
343 344 345 346 347 348 349 350 351 352 353 354 355 356 | void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){ assert( val>=0 ); assert( p->magic==VDBE_MAGIC_INIT ); if( p && addr>=0 && p->nOp>addr && p->aOp ){ p->aOp[addr].p2 = val; } } /* ** Change the value of the P3 operand for a specific instruction. ** This routine is useful when a large program is loaded from a ** static array using sqlite3VdbeAddOpList but we want to make a ** few minor changes to the program. ** | > > > > > > > > > > > > > > > > > > > > > | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){ assert( val>=0 ); assert( p->magic==VDBE_MAGIC_INIT ); if( p && addr>=0 && p->nOp>addr && p->aOp ){ p->aOp[addr].p2 = val; } } /* ** Delete a P3 value if necessary. */ static void freeP3(int p3type, void *p3){ if( p3 ){ if( p3type==P3_DYNAMIC || p3type==P3_KEYINFO ){ sqliteFree(p3); } if( p3type==P3_VDBEFUNC ){ VdbeFunc *pVdbeFunc = (VdbeFunc *)p3; sqlite3VdbeDeleteAuxData(pVdbeFunc, 0); sqliteFree(pVdbeFunc); } if( p3type==P3_MEM ){ sqlite3ValueFree((sqlite3_value*)p3); } } } /* ** Change the value of the P3 operand for a specific instruction. ** This routine is useful when a large program is loaded from a ** static array using sqlite3VdbeAddOpList but we want to make a ** few minor changes to the program. ** |
︙ | ︙ | |||
373 374 375 376 377 378 379 | ** ** If addr<0 then change P3 on the most recently inserted instruction. */ void sqlite3VdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){ Op *pOp; assert( p->magic==VDBE_MAGIC_INIT ); if( p==0 || p->aOp==0 ){ | < | < < < < < | | < | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | ** ** If addr<0 then change P3 on the most recently inserted instruction. */ void sqlite3VdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){ Op *pOp; assert( p->magic==VDBE_MAGIC_INIT ); if( p==0 || p->aOp==0 ){ freeP3(n, (void*)*(char**)&zP3); return; } if( addr<0 || addr>=p->nOp ){ addr = p->nOp - 1; if( addr<0 ) return; } pOp = &p->aOp[addr]; freeP3(pOp->p3type, pOp->p3); pOp->p3 = 0; if( zP3==0 ){ pOp->p3 = 0; pOp->p3type = P3_NOTUSED; }else if( n==P3_KEYINFO ){ KeyInfo *pKeyInfo; int nField, nByte; |
︙ | ︙ | |||
1327 1328 1329 1330 1331 1332 1333 | } if( p->pNext ){ p->pNext->pPrev = p->pPrev; } if( p->aOp ){ for(i=0; i<p->nOp; i++){ Op *pOp = &p->aOp[i]; | < < < < < < < < | < < | 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 | } if( p->pNext ){ p->pNext->pPrev = p->pPrev; } if( p->aOp ){ for(i=0; i<p->nOp; i++){ Op *pOp = &p->aOp[i]; freeP3(pOp->p3type, pOp->p3); } sqliteFree(p->aOp); } releaseMemArray(p->aVar, p->nVar); sqliteFree(p->aLabel); sqliteFree(p->aStack); releaseMemArray(p->aColName, p->nResColumn*2); |
︙ | ︙ |