1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix a bug in the OP_MemStore operator of the VDBE. A realloc() might

occur but pointer to the old buffer were not being moved over to
the new buffer. (CVS 752)

FossilOrigin-Name: 29145746f34438bd830c763872c5e82572150357
This commit is contained in:
drh
2002-09-17 03:20:46 +00:00
parent 995d71b715
commit 3e56c04c4e
4 changed files with 55 additions and 11 deletions

View File

@ -36,7 +36,7 @@
** 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.178 2002/09/14 13:47:32 drh Exp $
** $Id: vdbe.c,v 1.179 2002/09/17 03:20:46 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -4759,6 +4759,14 @@ case OP_MemStore: {
p->nMem = i + 5;
aMem = sqliteRealloc(p->aMem, p->nMem*sizeof(p->aMem[0]));
if( aMem==0 ) goto no_mem;
if( aMem!=p->aMem ){
int j;
for(j=0; j<nOld; j++){
if( aMem[j].z==p->aMem[j].s.z ){
aMem[j].z = aMem[j].s.z;
}
}
}
p->aMem = aMem;
if( nOld<p->nMem ){
memset(&p->aMem[nOld], 0, sizeof(p->aMem[0])*(p->nMem-nOld));