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

Fix a segfault that can occur after a malloc failure in an ANALYZE statement. Ticket #2772. (CVS 4544)

FossilOrigin-Name: d05eb67dd6e171cfe8b9528aa3c7c953780d8c82
This commit is contained in:
danielk1977
2007-11-15 13:10:22 +00:00
parent d0e2a85436
commit b8b4bfa061
4 changed files with 25 additions and 14 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code associated with the ANALYZE command.
**
** @(#) $Id: analyze.c,v 1.23 2007/08/29 17:43:20 drh Exp $
** @(#) $Id: analyze.c,v 1.24 2007/11/15 13:10:23 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_ANALYZE
#include "sqliteInt.h"
@@ -309,10 +309,12 @@ void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){
analyzeDatabase(pParse, iDb);
}else{
z = sqlite3NameFromToken(db, pName1);
pTab = sqlite3LocateTable(pParse, z, 0);
sqlite3_free(z);
if( pTab ){
analyzeTable(pParse, pTab);
if( z ){
pTab = sqlite3LocateTable(pParse, z, 0);
sqlite3_free(z);
if( pTab ){
analyzeTable(pParse, pTab);
}
}
}
}else{