Commit 9791a809 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Do not call the blc_array destructor to free the data. After calling a...

Do not call the blc_array destructor to free the data. After calling a destructor the variables are not accessible anymore. i.e. after the destructor of blc_channel is possibly on wrong values
parent 0cc3f425
......@@ -28,7 +28,7 @@ int main(int argc, char**argv){
char const *input_name, *output_name, *spectrum_option, *period_str;
FILE *file=NULL;
int ret;
int output_length, period, pos;
int output_length, period, pos=0;
size_t i;
fftwf_complex *intermediate;
fftwf_plan fftw_plan;
......@@ -56,7 +56,9 @@ int main(int argc, char**argv){
}
else{
ret=sscanf(output_name, "%*[:/.^]%*[^/]%n", &pos);
if (pos==strlen(output_name)) init_output_channel(&output, output_name, output_length); //C'est un blc_channel
if (pos==strlen(output_name))
init_output_channel(&output, output_name, output_length); //C'est un blc_channel
else //C'est un format de fichier
{
if (strcmp(blc_get_filename_extension(output_name), "tsv")!=0) EXIT_ON_ERROR("Filename extension must be .tsv but your file is: '%s'.\nThis is to be sure you are not overwriting important file by mistake", output_name);
......@@ -88,13 +90,11 @@ int main(int argc, char**argv){
}
if (output.fd == -1){
output.~blc_array();
FREE(output.data); //Otherwise the destructor of blc_channel tries to mumap it
}
fftwf_destroy_plan(fftw_plan);
blc_eprint_cursor_down(rows_nb);
blc_eprint_cursor_down(rows_nb);
if (file) SYSTEM_ERROR_CHECK(fclose(file), -1, NULL);
return EXIT_SUCCESS;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment