[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed May 7 22:29:22 CEST 2003


CVS commit by staikos: 

fix new[]/delete mismatch.  Still, this code also uses realloc().  Needs more
work.


  M +7 -7      kstrvector.cpp   1.7


--- kdeextragear-2/kst/kst/kstrvector.cpp  #1.6:1.7
@@ -184,5 +184,6 @@ void KstRVector::change(KstFile *in_file
   SPF = File->samplesPerFrame(Field.latin1());
 
-  delete V;
+  delete[] V;
+  V = 0L;
 
   if (ReqNF>0) {  // allocate the vector
@@ -195,5 +196,4 @@ void KstRVector::change(KstFile *in_file
   } else {     // ReqNF <= 0 means whole file, so just wait and see
     NumSamplesAlloc = 0;
-    V = 0L;
   }
   //update();
@@ -210,5 +210,6 @@ void KstRVector::changeFile(KstFile *in_
   SPF = File->samplesPerFrame(Field.latin1());
 
-  delete V;
+  delete[] V;
+  V = 0L;
 
   if (ReqNF>0) {  // allocate the vector
@@ -221,5 +222,4 @@ void KstRVector::changeFile(KstFile *in_
   } else {     // ReqNF <= 0 means whole file, so just wait and see
     NumSamplesAlloc = 0;
-    V = 0L;
   }
   //update();
@@ -250,5 +250,6 @@ void KstRVector::changeFrames(const int 
   SPF = File->samplesPerFrame(Field.latin1());
 
-  delete V;
+  delete[] V;
+  V = 0L;
 
   if (ReqNF>0) {  // allocate the vector
@@ -261,5 +262,4 @@ void KstRVector::changeFrames(const int 
   } else {     // ReqNF <= 0 means whole file, so just wait and see
     NumSamplesAlloc = 0;
-    V = 0L;
   }
   //update();
@@ -271,5 +271,5 @@ KstRVector::~KstRVector(){
   File->decUsage();  // deregister from the file
 
-  delete V;
+  delete[] V;
   V = 0L;
 




More information about the Kst mailing list