Attempt n+1 to pacify Coverity
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Feb 2012 14:38:52 +0000 (14:38 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Feb 2012 14:38:52 +0000 (14:38 +0000)
MUON/AliMUONPolygon.cxx

index c8388db..44b65bb 100644 (file)
@@ -117,29 +117,27 @@ void AliMUONPolygon::Copy(TObject& obj) const
   TObject::Copy(obj);
 
   AliMUONPolygon& rhs = static_cast<AliMUONPolygon&>(obj);
+  
+  delete [] rhs.fX;
+  delete [] rhs.fY;
 
-  Double_t* x(0x0);
-  Double_t* y(0x0);
+  rhs.fX = 0;
+  rhs.fY = 0;
+  rhs.fN = 0;
   
   if ( fN > 0 )
   {
-    x = new Double_t[fN];
-    y = new Double_t[fN];
+    rhs.fN = fN;
+
+    rhs.fX = new Double_t[rhs.fN];
+    rhs.fY = new Double_t[rhs.fN];
     
-    for ( Int_t i = 0; i < fN; ++i )
+    for ( Int_t i = 0; i < rhs.fN; ++i )
     {
-      x[i] = fX[i];
-      y[i] = fY[i];
+      rhs.fX[i] = fX[i];
+      rhs.fY[i] = fY[i];
     }
-  
-  }
-  
-  delete [] rhs.fX;
-  delete [] rhs.fY;
-  
-  rhs.fX = x;
-  rhs.fY = y;
-  rhs.fN = fN;  
+  }  
 }
 
 //_____________________________________________________________________________