logApply trigger free()s data from wrong cache entry on evict.
authorJan Wieck <JanWieck@Yahoo.com>
Wed, 29 Jan 2014 17:11:57 +0000 (12:11 -0500)
committerJan Wieck <JanWieck@Yahoo.com>
Thu, 6 Feb 2014 17:18:21 +0000 (12:18 -0500)
src/backend/slony1_funcs.c

index 506b6f90ec5d3b64fd294c5d437e972f5ba6a3c5..933cbe480c807b9e5211cd6df38c985773b7bfbf 100644 (file)
@@ -1782,10 +1782,13 @@ versionFunc(logApply)(PG_FUNCTION_ARGS)
 
                        SPI_freeplan(evict->plan);
                        oldContext = MemoryContextSwitchTo(applyCacheContext);
-                       pfree(cacheEnt->finfo_input);
-                       pfree(cacheEnt->typioparam);
-                       pfree(cacheEnt->typmod);
+                       pfree(evict->finfo_input);
+                       pfree(evict->typioparam);
+                       pfree(evict->typmod);
                        MemoryContextSwitchTo(oldContext);
+                       evict->finfo_input = NULL;
+                       evict->typioparam = NULL;
+                       evict->typmod = NULL;
                        evict->plan = NULL;
 #ifdef APPLY_CACHE_VERIFY
                        evict->evicted = 1;