File tree 1 file changed +23
-2
lines changed
src/backend/access/smerge
1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -824,8 +824,19 @@ sm_flush(Relation heapRel, SmMetadata* metadata) {
824
824
_bt_spool (btspools [j ], & (scan -> xs_itup -> t_tid ), values , isnull );
825
825
}
826
826
827
+ SmScanOpaque so = (SmScanOpaque ) scan -> opaque ;
828
+
827
829
index_endscan (scan );
828
- index_close (indexRel , ExclusiveLock );
830
+ if (so -> bt_rel != NULL ) {
831
+ index_close (so -> bt_rel , ExclusiveLock );
832
+ pfree (so -> bt_rel );
833
+ so -> bt_rel = NULL ;
834
+ }
835
+ /* Release metadata */
836
+ if (so -> metadata != NULL )
837
+ pfree (so -> metadata );
838
+
839
+ pfree (so );
829
840
830
841
831
842
tuplesort_performsort (btspools [j ]-> sortstate );
@@ -944,9 +955,19 @@ sm_flush(Relation heapRel, SmMetadata* metadata) {
944
955
_bt_spool (btspools [j ], & (scan -> xs_itup -> t_tid ), values , isnull );
945
956
}
946
957
958
+ SmScanOpaque so = (SmScanOpaque ) scan -> opaque ;
959
+
947
960
index_endscan (scan );
948
- index_close (indexRel , ExclusiveLock );
961
+ if (so -> bt_rel != NULL ) {
962
+ index_close (so -> bt_rel , ExclusiveLock );
963
+ pfree (so -> bt_rel );
964
+ so -> bt_rel = NULL ;
965
+ }
966
+ /* Release metadata */
967
+ if (so -> metadata != NULL )
968
+ pfree (so -> metadata );
949
969
970
+ pfree (so );
950
971
951
972
tuplesort_performsort (btspools [j ]-> sortstate );
952
973
}
You can’t perform that action at this time.
0 commit comments