Fix bizarre "delete[] fNames", where fNames is a *static*
authorOrion Lawlor <olawlor@acm.org>
Mon, 23 Dec 2002 20:36:20 +0000 (20:36 +0000)
committerOrion Lawlor <olawlor@acm.org>
Mon, 23 Dec 2002 20:36:20 +0000 (20:36 +0000)
array of dynamic string-pointers.

Right solution is to have all language-related stuff in a
class, with its own destructor; temporary fix is to delete
the appropriate thing.

src/conv-perf/traceCore.C

index 3d388e94a127321b5f52eaded15cd4196d2cb850..5d1b0eb4941e06cabef309549ef1885de4ec6394 100644 (file)
@@ -267,6 +267,10 @@ TraceLogger::TraceLogger(char* program, int b):
  // pool = new TraceEntry[500];
   poolSize = CpvAccess(_traceCoreBufferSize);
   
+  for (int lID=0;lID<MAX_NUM_LANGUAGES;lID++) {
+    lName[lID]=NULL;
+    fName[lID]=NULL;
+  }
 
   pgm = new char[strlen(program)+1];
   sprintf(pgm, "%s", program);
@@ -289,8 +293,10 @@ TraceLogger::~TraceLogger()
   { lastWriteFlag = 1; writeBinary(); }
   else
   { lastWriteFlag = 1; write(); }
-  delete [] pool;
-  delete [] fName;
+  for (int lID=0;lID<MAX_NUM_LANGUAGES;lID++) {
+    delete[] lName[lID];
+    delete[] fName[lID];
+  }
 }
 
 void TraceLogger::RegisterLanguage(int lID, char* ln)