From 98e9206e39cfa9ab49592f4edf999c815c7e2827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Mon, 18 May 2015 16:08:26 +0200 Subject: [PATCH] Allocate the correct size --- Compiler/runtime/SimulationResults.c | 5 ++++- common | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Compiler/runtime/SimulationResults.c b/Compiler/runtime/SimulationResults.c index 48c6c79352d..35567af131c 100644 --- a/Compiler/runtime/SimulationResults.c +++ b/Compiler/runtime/SimulationResults.c @@ -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)) { @@ -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; diff --git a/common b/common index ec62513e656..d52ab4e30b9 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit ec62513e656d2a50bf7e1b5ac8a49ea926d8e41e +Subproject commit d52ab4e30b913ba383613f53a3792a3eaae33d21