mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
More changes for 2.0.7. (CVS 293)
FossilOrigin-Name: f8328a5f11801c5124f9a8dace22df3c1cfb2191
This commit is contained in:
15
src/table.c
15
src/table.c
@@ -53,12 +53,14 @@ static int sqlite_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
|
||||
need = nCol;
|
||||
}
|
||||
if( p->nData + need >= p->nAlloc ){
|
||||
char **azNew;
|
||||
p->nAlloc = p->nAlloc*2 + need + 1;
|
||||
p->azResult = realloc( p->azResult, sizeof(char*)*p->nAlloc );
|
||||
if( p->azResult==0 ){
|
||||
azNew = realloc( p->azResult, sizeof(char*)*p->nAlloc );
|
||||
if( azNew==0 ){
|
||||
p->rc = SQLITE_NOMEM;
|
||||
return 1;
|
||||
}
|
||||
p->azResult = azNew;
|
||||
}
|
||||
|
||||
/* If this is the first row, then generate an extra row containing
|
||||
@@ -150,8 +152,13 @@ int sqlite_get_table(
|
||||
return rc;
|
||||
}
|
||||
if( res.nAlloc>res.nData ){
|
||||
res.azResult = realloc( res.azResult, sizeof(char*)*(res.nData+1) );
|
||||
if( res.azResult==0 ) return SQLITE_NOMEM;
|
||||
char **azNew;
|
||||
azNew = realloc( res.azResult, sizeof(char*)*(res.nData+1) );
|
||||
if( res.azResult==0 ){
|
||||
sqlite_free_table(&res.azResult[1]);
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
res.azResult = azNew;
|
||||
}
|
||||
*pazResult = &res.azResult[1];
|
||||
if( pnColumn ) *pnColumn = res.nColumn;
|
||||
|
Reference in New Issue
Block a user