Skip to content

Commit e5ee22f

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 3a3891e commit e5ee22f

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
@@ -9670,6 +9670,7 @@ void TTree::Streamer(TBuffer& b)
96709670
fDirectory = nullptr;
96719671
fCacheDoAutoInit = true;
96729672
fCacheUserSet = false;
9673+
fNamesToBranches.clear();
96739674
Version_t R__v = b.ReadVersion(&R__s, &R__c);
96749675
if (R__v > 4) {
96759676
b.ReadClassBuffer(TTree::Class(), this, R__v, R__s, R__c);

0 commit comments

Comments
 (0)