From c430d69eed8f159e9995ed5d5fd103ddf29cf396 Mon Sep 17 00:00:00 2001 From: zhangjinpeng1987 Date: Mon, 19 Jun 2017 11:39:45 -0700 Subject: [PATCH] fix coredump for release nullptr Summary: Coredump will be triggered when ingest external sst file after delete range. ref https://github.com/facebook/rocksdb/issues/2398 Closes https://github.com/facebook/rocksdb/pull/2463 Differential Revision: D5275599 Pulled By: ajkr fbshipit-source-id: 0828dbc062ea8c74e913877cd63494fd3478a30d --- db/table_cache.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/table_cache.cc b/db/table_cache.cc index 287f3dea9..ad8282cc1 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -286,7 +286,9 @@ InternalIterator* TableCache::NewRangeTombstoneIterator( if (s.ok()) { result = table_reader->NewRangeTombstoneIterator(options); if (result != nullptr) { - result->RegisterCleanup(&UnrefEntry, cache_, handle); + if (handle != nullptr) { + result->RegisterCleanup(&UnrefEntry, cache_, handle); + } } } if (result == nullptr && handle != nullptr) {