aboutsummaryrefslogtreecommitdiff
path: root/tool/sqldiff.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-08-14 16:14:40 +0000
committerdan <dan@noemail.net>2020-08-14 16:14:40 +0000
commite0404386f265f2af09777eefb21f97f9333b95bb (patch)
tree04bcf993ee0172e8f89f633af3bdf7e1b06ebf7b /tool/sqldiff.c
parentef215fbf3b581ef4e0273bb3932fa522af88fd7e (diff)
downloadsqlite-e0404386f265f2af09777eefb21f97f9333b95bb.tar.gz
sqlite-e0404386f265f2af09777eefb21f97f9333b95bb.zip
Fix an inconsequential memory leak in sqldiff. Update the "Sanitize" case in wapptest.tcl to use -fsanitize=address,undefined, and to run more tests.
FossilOrigin-Name: 613fb5c2525be77e48bad0a74e8b7bf53489365060fb9c7713a0caddb1820c71
Diffstat (limited to 'tool/sqldiff.c')
-rw-r--r--tool/sqldiff.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tool/sqldiff.c b/tool/sqldiff.c
index 3590e2c06..85cae56de 100644
--- a/tool/sqldiff.c
+++ b/tool/sqldiff.c
@@ -1544,6 +1544,7 @@ static void changeset_one_table(const char *zTab, FILE *out){
/* Check that the schemas of the two tables match. Exit early otherwise. */
checkSchemasMatch(zTab);
+ strInit(&sql);
pStmt = db_prepare("PRAGMA main.table_info=%Q", zTab);
while( SQLITE_ROW==sqlite3_step(pStmt) ){
@@ -1565,7 +1566,6 @@ static void changeset_one_table(const char *zTab, FILE *out){
}
sqlite3_finalize(pStmt);
if( nPk==0 ) goto end_changeset_one_table;
- strInit(&sql);
if( nCol>nPk ){
strPrintf(&sql, "SELECT %d", SQLITE_UPDATE);
for(i=0; i<nCol; i++){
@@ -1707,6 +1707,8 @@ end_changeset_one_table:
sqlite3_free(azCol);
sqlite3_free(aiPk);
sqlite3_free(zId);
+ sqlite3_free(aiFlg);
+ strFree(&sql);
}
/*
@@ -1971,6 +1973,8 @@ int main(int argc, char **argv){
#endif
zSql = sqlite3_mprintf("ATTACH %Q as aux;", zDb2);
rc = sqlite3_exec(g.db, zSql, 0, 0, &zErrMsg);
+ sqlite3_free(zSql);
+ zSql = 0;
if( rc || zErrMsg ){
cmdlineError("cannot attach database \"%s\"", zDb2);
}