Skip to content

Commit c76ee42

Browse files
committed
Fix memory leaks in TStorageFactoryFile and StorageAccountProxy
These memory leaks were introduced in 1f0a685 when these pointers were migrated from raw pointers to smart pointers. The earlier code deleted the pointers, so reset() is the correct behavior here.
1 parent 2ddeb78 commit c76ee42

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

IOPool/TFileAdaptor/interface/TStorageFactoryFile.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ class TStorageFactoryFile : public TFile {
5555

5656
Bool_t ReadBuffersSync(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);
5757

58-
void releaseStorage() { get_underlying_safe(storage_).release(); }
59-
6058
TStorageFactoryFile(void);
6159

6260
edm::propagate_const<std::unique_ptr<edm::storage::Storage>> storage_; //< Real underlying storage

IOPool/TFileAdaptor/src/TStorageFactoryFile.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ Int_t TStorageFactoryFile::SysClose(Int_t /* fd */) {
564564

565565
if (storage_) {
566566
storage_->close();
567-
releaseStorage();
567+
get_underlying_safe(storage_).reset();
568568
}
569569

570570
stats.tick();

Utilities/StorageFactory/interface/StorageAccountProxy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace edm::storage {
4040
void close(void) override;
4141

4242
protected:
43-
void releaseStorage() { get_underlying_safe(m_baseStorage).release(); }
43+
void resetStorage() { get_underlying_safe(m_baseStorage).reset(); }
4444

4545
edm::propagate_const<std::unique_ptr<Storage>> m_baseStorage;
4646

Utilities/StorageFactory/src/StorageAccountProxy.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ StorageAccountProxy::StorageAccountProxy(const std::string &storageClass, std::u
1616

1717
StorageAccountProxy::~StorageAccountProxy() {
1818
StorageAccount::Stamp stats(StorageAccount::counter(m_token, StorageAccount::Operation::destruct));
19-
releaseStorage();
19+
resetStorage();
2020
stats.tick();
2121
}
2222

0 commit comments

Comments
 (0)