1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Fix memory allocation problem in the sqlite_get_table() API. Ticket #315. (CVS 976)

FossilOrigin-Name: f1d955efd91093994db43a1540080d32442d5ac0
This commit is contained in:
drh
2003-05-17 00:05:49 +00:00
parent a996e477d0
commit 9335247003
3 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Make\ssure\sthe\sON\sCONFLICT\sclause\son\sa\sBEGIN\soverrides\sthe\sconflict\sresolution\nspecified\sby\san\sindex.\s\sThis\sfixes\sa\sbug\sreported\son\sthe\snewsgroup.\s(CVS\s975)
D 2003-05-16T02:30:27
C Fix\smemory\sallocation\sproblem\sin\sthe\ssqlite_get_table()\sAPI.\s\sTicket\s#315.\s(CVS\s976)
D 2003-05-17T00:05:50
F Makefile.in 004acec253ecdde985c8ecd5b7c9accdb210378f
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -48,7 +48,7 @@ F src/shell.c 2565cb32cd862024bcfd88400e05437636cf21a1
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in eec06462cba262c0ee03f38462a18a4bc66dda4e
F src/sqliteInt.h 9b64d8225a26f3d5a376370b31060dd70bcc362b
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/table.c 4301926464d88d2c2c7cd21c3360aa75bf068b95
F src/tclsqlite.c 9e25f98f1765afa0716144ef57abda75c88f688d
F src/test1.c 4596acd9d9f2a49fda0160a8a6dee5bfc7c6c325
F src/test2.c 5014337d8576b731cce5b5a14bec4f0daf432700
@ -165,7 +165,7 @@ F www/speed.tcl cb4c10a722614aea76d2c51f32ee43400d5951be
F www/sqlite.tcl 4bd1729e320f5fa9125f0022b281fbe839192125
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P 4183cf97676e64d19978941a7c4a3fe521fcb1fb
R ceda8451adba59b6260a922bc13b596c
P 0f92736d1fbe3b587592fe1f26dfb3558cc49727
R ead816a07db427380be0139245529b1b
U drh
Z ca1fb5800fb2c1a110aee865c12a3008
Z 9c4183fd3600141a5186400d5209fe8f

View File

@ -1 +1 @@
0f92736d1fbe3b587592fe1f26dfb3558cc49727
f1d955efd91093994db43a1540080d32442d5ac0

View File

@ -172,10 +172,11 @@ int sqlite_get_table(
if( res.nAlloc>res.nData ){
char **azNew;
azNew = realloc( res.azResult, sizeof(char*)*(res.nData+1) );
if( res.azResult==0 ){
if( azNew==0 ){
sqlite_free_table(&res.azResult[1]);
return SQLITE_NOMEM;
}
res.nAlloc = res.nData+1;
res.azResult = azNew;
}
*pazResult = &res.azResult[1];
@ -193,6 +194,7 @@ void sqlite_free_table(
if( azResult ){
int i, n;
azResult--;
if( azResult==0 ) return;
n = (int)azResult[0];
for(i=1; i<n; i++){ if( azResult[i] ) free(azResult[i]); }
free(azResult);