]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDEvent.cxx
- leak corrected
[u/mrichter/AliRoot.git] / STEER / AliESDEvent.cxx
index ac840d802b2940747f3827ccf6a7970c1f8cb68b..ca80972ee287ee6125bb19fb604137e03b9df271 100644 (file)
@@ -1349,7 +1349,7 @@ void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){
 
     // Connect to tree
     // prevent a memory leak when reading back the TList
-    // if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete();
+    if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete();
     
     if(!fUseOwnList){
       // create a new TList from the UserInfo TList... 
@@ -1378,7 +1378,8 @@ void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){
       if(bname.CompareTo("AliESDfriend")==0)
        {
          // AliESDfriend does not have a name ...
-         tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el));
+           TBranch *br = tree->GetBranch(bname.Data());
+           if (br) tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el));
        }
       else{
        // check if branch exists under this Name