]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
coverity
authorjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Jun 2011 07:09:15 +0000 (07:09 +0000)
committerjotwinow <jotwinow@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Jun 2011 07:09:15 +0000 (07:09 +0000)
PWG1/TPC/AliTreeDraw.cxx

index 5b0dc79bb7e7b7f28eaaacef9bb2611a09839386..374b6540d5c7f0720a75f2192b2177074a60ef59 100644 (file)
@@ -625,11 +625,10 @@ TString* AliTreeDraw::FitPlane(const char* drawCommand, const char* formula, con
    Int_t entries = fTree->Draw(drawStr.Data(), cutStr.Data(), "goff",  stop-start, start);
    if (entries == -1) return new TString("An ERROR has occured during fitting!");
    Double_t **values = new Double_t*[dim+1] ; 
+   if(!(*values)) {
+      return new TString("Cannot create *values !");
+   } 
 
-   for (Int_t i = 0; i < dim + 1; i++){
-     *values[i] = 0;
-   }
-   
    for (Int_t i = 0; i < dim + 1; i++) {
       Int_t centries = 0;
       if (i < dim) centries = fTree->Draw(((TObjString*)formulaTokens->At(i))->GetName(), cutStr.Data(), "goff", stop-start,start);
@@ -640,7 +639,8 @@ TString* AliTreeDraw::FitPlane(const char* drawCommand, const char* formula, con
         if(values) delete[] values;
         return new TString("An ERROR has occured during fitting!");
       }
-      
+      *values[i] = 0;
+
       values[i] = new Double_t[entries];
       memcpy(values[i],  fTree->GetV1(), entries*sizeof(Double_t)); 
    }