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

Avoid trying to allocation zero bytes when analyzing a unique non-null index.

FossilOrigin-Name: 85e2badeeb7f7599eb6fd35512f9bd524f0b1b3f
This commit is contained in:
drh
2014-07-24 20:25:16 +00:00
parent 9d793325b0
commit b12879fd1a
3 changed files with 12 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
C Avoid\schange\stests\swhen\sanalyzing\ssingle-column\sunique\sindexes\safter\ngetting\spast\sthe\sinitial\sNULL\sentries.
D 2014-07-24T19:54:20.150
C Avoid\strying\sto\sallocation\szero\sbytes\swhen\sanalyzing\sa\sunique\snon-null\sindex.
D 2014-07-24T20:25:16.037
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -161,7 +161,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c b00900877f766f116f9e16116f1ccacdc21d82f1
F src/analyze.c 45216a14e7e71084859d2899cd323b2f597f8527
F src/analyze.c 9799a65d8e8892e6eb96d0094a1d4fa6d7aebd0e
F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
@@ -1183,7 +1183,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 30033f965030a015fad15e532bcaba1314c8cc0f
R e98a107e1f5891c465c70c3fe5e38f27
P 4690e99c07024f40fafba1db8e4487b287b788a9
R 665515c1fc4ab29e7e80bbd8e675bbe2
U drh
Z 7cfd64b5f36044a7bdee3831c72ee79f
Z 06b30e9b7410b92f6a1122ec1ae06529

View File

@@ -1 +1 @@
4690e99c07024f40fafba1db8e4487b287b788a9
85e2badeeb7f7599eb6fd35512f9bd524f0b1b3f

View File

@@ -1014,7 +1014,6 @@ static void analyzeOneTable(
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
int nCol; /* Number of columns in pIdx. "N" */
int *aGotoChng; /* Array of jump instruction addresses */
int addrRewind; /* Address of "OP_Rewind iIdxCur" */
int addrNextRow; /* Address of "next_row:" */
const char *zIdxName; /* Name of the index */
@@ -1031,8 +1030,6 @@ static void analyzeOneTable(
zIdxName = pIdx->zName;
nColTest = pIdx->uniqNotNull ? pIdx->nKeyCol-1 : nCol-1;
}
aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*nColTest);
if( aGotoChng==0 ) continue;
/* Populate the register containing the index name. */
sqlite3VdbeAddOp4(v, OP_String8, 0, regIdxname, 0, zIdxName, 0);
@@ -1116,6 +1113,10 @@ static void analyzeOneTable(
if( nColTest>0 ){
int endDistinctTest = sqlite3VdbeMakeLabel(v);
int *aGotoChng; /* Array of jump instruction addresses */
aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*nColTest);
if( aGotoChng==0 ) continue;
/*
** next_row:
** regChng = 0
@@ -1161,6 +1162,7 @@ static void analyzeOneTable(
sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regPrev+i);
}
sqlite3VdbeResolveLabel(v, endDistinctTest);
sqlite3DbFree(db, aGotoChng);
}
/*
@@ -1247,7 +1249,6 @@ static void analyzeOneTable(
/* End of analysis */
sqlite3VdbeJumpHere(v, addrRewind);
sqlite3DbFree(db, aGotoChng);
}