From 5dc52d357ad41bcbd945f360df2d49a7701f8776 Mon Sep 17 00:00:00 2001
From: Dan Kennedy <danielk1977@gmail.com>
Date: Wed, 16 Jan 2019 11:38:06 +0000
Subject: [PATCH 0775/1009] Fix a memory leak that could occur in fts3 when
 handling a corrupt database.

https://github.com/mackyle/sqlite/commit/5dc52d357ad41bcbd945f360df2d49a7701f8776

---
 ext/fts3/fts3_write.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c
index 0baf82b..096eafc 100644
--- a/ext/fts3/fts3_write.c
+++ b/ext/fts3/fts3_write.c
@@ -1606,6 +1606,7 @@ int sqlite3Fts3SegReaderNew(
 
   assert( iStartLeaf<=iEndLeaf );
   if( iStartLeaf==0 ){
+    if( iEndLeaf!=0 ) return FTS_CORRUPT_VTAB;
     nExtra = nRoot + FTS3_NODE_PADDING;
   }
 
-- 
1.8.3.1

