[Genabel-commits] r1236 - in pkg/GenABEL: . src/GAlib

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 30 13:37:05 CEST 2013


Author: lckarssen
Date: 2013-05-30 13:37:04 +0200 (Thu, 30 May 2013)
New Revision: 1236

Modified:
   pkg/GenABEL/CHANGES.LOG
   pkg/GenABEL/src/GAlib/export_plink.cpp
Log:
Fixed bug #2055 in GenABEL's export.plink() option. Exporting to .ped files had two memory leaks. 


Modified: pkg/GenABEL/CHANGES.LOG
===================================================================
--- pkg/GenABEL/CHANGES.LOG	2013-05-30 11:22:32 UTC (rev 1235)
+++ pkg/GenABEL/CHANGES.LOG	2013-05-30 11:37:04 UTC (rev 1236)
@@ -1,3 +1,8 @@
+***  v. 1.7-
+
+(2013.05.30)
+Fixed memory leak in export.plink() when exporting to .ped format (Bug #2055).
+
 ***  v. 1.7-6
 
 (2013.05.16)

Modified: pkg/GenABEL/src/GAlib/export_plink.cpp
===================================================================
--- pkg/GenABEL/src/GAlib/export_plink.cpp	2013-05-30 11:22:32 UTC (rev 1235)
+++ pkg/GenABEL/src/GAlib/export_plink.cpp	2013-05-30 11:37:04 UTC (rev 1236)
@@ -5,7 +5,7 @@
 extern "C" {
 #endif
 
-std::string* getGenotype(std::string coding,std::string sep)
+std::string* getGenotype(std::string coding, std::string sep)
 {
     std::string* Genotype = new (std::nothrow) std::string [4];
     std::string Letter0 = coding.substr(0,1);
@@ -109,7 +109,7 @@
             Genotype = getGenotype(coding[csnp], sep);
             // figure out the coding
             fileWoA << " " << Genotype[gtMatrix[i][csnp]];
-            //fileWoA << " x" << Letter0 << Letter1 << Genotype[0] << Genotype[1] << Genotype[2] << Genotype[3];
+            delete [] Genotype;
         }
         // end unwrap
         fileWoA << "\n";
@@ -122,8 +122,12 @@
     //Rprintf("oooo!\n" );
 
     sex.clear();
+
+    for(int i=0; i<nids; i++) {
+        delete [] gtMatrix[i];
+    }
     delete [] gtMatrix;
-    delete [] Genotype;
+
     delete [] gtint;
 
     return R_NilValue;



More information about the Genabel-commits mailing list