IMPALA-14443: Fix potential memory leak in TmpFileMgr

Clang static analyzer found a potential memory leak in
TmpFileMgr. In some cases we forget the deletion of a
newly created TmpFileRemote object. This patch replaces
the raw pointer with a unique_ptr.

Change-Id: I5a516eab1a946e7368c6059f8d1cc430d2ee19e9
Reviewed-on: http://gerrit.cloudera.org:8080/23431
Reviewed-by: Riza Suminto <riza.suminto@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Zoltan Borok-Nagy
2025-09-16 15:53:33 +02:00
committed by Impala Public Jenkins
parent 2efd22bd73
commit 850f2cf361

View File

@@ -1475,7 +1475,7 @@ Status TmpFileGroup::AllocateRemoteSpace(int64_t num_bytes, TmpFile** tmp_file,
const string& local_buffer_dir = tmp_file_mgr_->local_buff_dir_->path();
string new_file_path_local = GenerateNewPath(local_buffer_dir, unique_name);
TmpFileRemote* tmp_file_r = new TmpFileRemote(
unique_ptr<TmpFileRemote> tmp_file_r = make_unique<TmpFileRemote>(
this, dev_id, new_file_path, new_file_path_local, false, dir.c_str());
if (tmp_file_r == nullptr) {
return Status("Failed to allocate temporary file object.");