Skip to content

Commit fd4b93f

Browse files
committed
[tree] Reset fNamesToBranches map in Streamer()
When reading, the Streamer() function may reuse the Tree. If the fNamesToBranch map is not invalidated GetBranch() may return stale pointers to freed memory. Fixes #20706 (cherry picked from commit 7603459)
1 parent 0b1603c commit fd4b93f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tree/tree/src/TTree.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9823,6 +9823,7 @@ void TTree::Streamer(TBuffer& b)
98239823
fDirectory = nullptr;
98249824
fCacheDoAutoInit = true;
98259825
fCacheUserSet = false;
9826+
fNamesToBranches.clear();
98269827
Version_t R__v = b.ReadVersion(&R__s, &R__c);
98279828
if (R__v > 4) {
98289829
b.ReadClassBuffer(TTree::Class(), this, R__v, R__s, R__c);

0 commit comments

Comments
 (0)