[Genabel-commits] r1830 - pkg/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Sep 23 12:32:31 CEST 2014
Author: lckarssen
Date: 2014-09-23 12:32:30 +0200 (Tue, 23 Sep 2014)
New Revision: 1830
Modified:
pkg/ProbABEL/src/phedata.cpp
Log:
Bug fix: Changed a variable from char array into std::string in ProbABEL's phedata. The C-string was introduced in r1803 as part of a bug fix.
Unfortunaetely that commit introduced a memory leak because the array wasn't free'd. the std:string implementation from the current commit doesn't have the memory leak issue.
Thanks to Jenkins' Valgrind plugin for catching the memory leak :-)!
Modified: pkg/ProbABEL/src/phedata.cpp
===================================================================
--- pkg/ProbABEL/src/phedata.cpp 2014-09-23 08:07:06 UTC (rev 1829)
+++ pkg/ProbABEL/src/phedata.cpp 2014-09-23 10:32:30 UTC (rev 1830)
@@ -27,7 +27,6 @@
#include <fstream>
#include <cstdarg>
#include <cstdlib>
-#include <cstring>
using std::cout;
using std::cerr;
@@ -67,7 +66,7 @@
std::ifstream myfile(fname);
char *line = new char[BFS];
char *tmp = new char[BFS];
- char *interaction_cov_name = new char[BFS];
+ std::string interaction_cov_name;
noutcomes = noutc;
is_interaction_excluded = false;
@@ -164,7 +163,7 @@
<< ", n_model_terms=" << n_model_terms << "\n";
if (n_model_terms == interaction && is_interaction_excluded)
{
- strcpy(interaction_cov_name, tmp);
+ interaction_cov_name = tmp;
continue;
}
More information about the Genabel-commits
mailing list