]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Reimplement CurrentVolName() to avoid memory leaks
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Nov 1999 16:55:39 +0000 (16:55 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 26 Nov 1999 16:55:39 +0000 (16:55 +0000)
TGeant3/TGeant3.cxx

index 0a543d4c8f9af944c202bc42add968ffba00ca4e..49a03a51dd8774bed0f46ee2eb8c00463eeaab45 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.17  1999/11/03 16:58:28  fca
+Correct source of address violation in creating character string
+
 Revision 1.16  1999/11/03 13:17:08  fca
 Have ProdProcess return const char*
 
@@ -650,12 +653,11 @@ const char* TGeant3::CurrentVolName() const
   // Returns the current volume name
   //
   Int_t i, gname;
-  char *name;
+  static char name[5];
   if( (i=fGcvolu->nlevel-1) < 0 ) {
     Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
   } else {
     gname=fGcvolu->names[i];
-    name = new char[5];
     strncpy(name,(char *) &gname, 4);
     name[4]='\0';
     i=fGcvolu->lvolum[i];