From d651ad3b3d42dfe3fc26023ae2c61d04802cd721 Mon Sep 17 00:00:00 2001
From: "D. Richard Hipp" <drh@hwaci.com>
Date: Tue, 19 Feb 2019 17:45:31 +0000
Subject: [PATCH 0956/1009] Fix a potential memory leak in RBU if the
 rbu_fossil_delta() SQL function is misused.  Misuse never happens in a
 working RBU system, so this is not a particularly important fix.

https://github.com/mackyle/sqlite/commit/d651ad3b3d42dfe3fc26023ae2c61d04802cd721

---
 ext/rbu/sqlite3rbu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ext/rbu/sqlite3rbu.c b/ext/rbu/sqlite3rbu.c
index e86606b..1a78adc 100644
--- a/ext/rbu/sqlite3rbu.c
+++ b/ext/rbu/sqlite3rbu.c
@@ -684,6 +684,7 @@ static void rbuFossilDeltaFunc(
   }else{
     nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);
     if( nOut2!=nOut ){
+      sqlite3_free(aOut);
       sqlite3_result_error(context, "corrupt fossil delta", -1);
     }else{
       sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
-- 
1.8.3.1

