From e56b431dc3df968a94b4af71c50eb5180e9eecf0 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 7 May 2020 17:41:23 +0200 Subject: [PATCH] trim crash fix --- .../mythen3DetectorServer/slsDetectorFunctionList.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 83f872037..806ec72d3 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -742,17 +742,21 @@ int setTrimbits(int *trimbits) { } int setAllTrimbits(int val) { - int trimbits[NCHAN]; + int *trimbits = malloc(sizeof(int) * NCHAN); int ichan = 0; for (ichan = 0; ichan < NCHAN; ++ichan) { trimbits[ichan] = val; } if (setTrimbits(trimbits) == FAIL) { LOG(logERROR, ("Could not set all trimbits to %d\n", val)); + free(trimbits); return FAIL; } - + // setSettings(UNDEFINED); + // LOG(logERROR, ("Settings has been changed to undefined (random " + // "trim file)\n")); LOG(logINFO, ("All trimbits have been set to %d\n", val)); + free(trimbits); return OK; }