41 lines
1.1 KiB
Diff
41 lines
1.1 KiB
Diff
From 259c8907624a568bd0faa10687f659c9321f9a05 Mon Sep 17 00:00:00 2001
|
|
From: "D. Richard Hipp" <drh@hwaci.com>
|
|
Date: Mon, 29 Oct 2018 18:33:42 +0000
|
|
Subject: [PATCH 0473/1009] Fix minor memory leak in the dbstat extension that
|
|
can occur following an attempt to analyze a corrupt database file.
|
|
|
|
From https://github.com/mackyle/sqlite/commit/259c8907624a568bd0faa10687f659c9321f9a05
|
|
|
|
---
|
|
src/dbstat.c | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/dbstat.c b/src/dbstat.c
|
|
index 432cfae..b746fa0 100644
|
|
--- a/src/dbstat.c
|
|
+++ b/src/dbstat.c
|
|
@@ -254,7 +254,7 @@ static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
|
|
return SQLITE_OK;
|
|
}
|
|
|
|
-static void statClearPage(StatPage *p){
|
|
+static void statClearCells(StatPage *p){
|
|
int i;
|
|
if( p->aCell ){
|
|
for(i=0; i<p->nCell; i++){
|
|
@@ -262,6 +262,11 @@ static void statClearPage(StatPage *p){
|
|
}
|
|
sqlite3_free(p->aCell);
|
|
}
|
|
+ p->nCell = 0;
|
|
+ p->aCell = 0;
|
|
+}
|
|
+static void statClearPage(StatPage *p){
|
|
+ statClearCells(p);
|
|
sqlite3PagerUnref(p->pPg);
|
|
sqlite3_free(p->zPath);
|
|
memset(p, 0, sizeof(StatPage));
|
|
--
|
|
1.8.3.1
|
|
|