Skip to content

Commit

Permalink
Allocate the correct size
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed May 18, 2015
1 parent ba5b824 commit 98e9206
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Compiler/runtime/SimulationResults.c
Expand Up @@ -592,7 +592,7 @@ int SimulationResults_filterSimulationResults(const char *inFile, const char *ou
if (numberOfIntervals) {
omc_matlab4_read_all_vals(&simresglob.matReader);
nrows = numberOfIntervals+1;
vals = GC_malloc_atomic(nrows);
vals = GC_malloc_atomic(sizeof(double)*nrows);
for (j=0; j<=numberOfIntervals; j++) {
ModelicaMatVariable_t var = {.name="", .descr="", .isParam=0, .index=indexesToOutput[i]};
if (omc_matlab4_val(vals+j, &simresglob.matReader, &var, start + (stop-start)*((double)j)/numberOfIntervals)) {
Expand All @@ -606,6 +606,9 @@ int SimulationResults_filterSimulationResults(const char *inFile, const char *ou
if (1!=fwrite(vals, sizeof(double)*nrows, 1, fout)) {
return failedToWriteToFile(outFile);
}
if (numberOfIntervals) {
GC_free(vals);
}
}
fclose(fout);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion common
Submodule common updated 1 files
+6 −3 m4/pre-commit.m4

0 comments on commit 98e9206

Please sign in to comment.