diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index b756c7b24..07a994a58 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -5101,12 +5101,16 @@ int slsDetector::programFPGA(std::string fname) { if(fread(fpgasrc, sizeof(char), filesize, fp) != filesize){ std::cout << "Could not read rawbin file" << std::endl; setErrorMask((getErrorMask())|(PROGRAMMING_ERROR)); + if(fpgasrc != NULL) + free(fpgasrc); return FAIL; } if(fclose(fp)){ std::cout << "Could not close destination file after converting" << std::endl; setErrorMask((getErrorMask())|(PROGRAMMING_ERROR)); + if(fpgasrc != NULL) + free(fpgasrc); return FAIL; } unlink(destfname); // delete temporary file diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp index d0198f96d..9b60f3731 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp @@ -21,6 +21,8 @@ slsDetectorUsers::slsDetectorUsers(int& ret, int id) : myDetector(0), myCmd(0){ slsDetectorUsers::~slsDetectorUsers() { if (myDetector) delete myDetector; + if (myCmd) + delete myCmd; } int slsDetectorUsers::getNumberOfDetectors() { diff --git a/slsSupportLib/include/sls_detector_funcs.h b/slsSupportLib/include/sls_detector_funcs.h index 46173eaec..1ed9f1192 100644 --- a/slsSupportLib/include/sls_detector_funcs.h +++ b/slsSupportLib/include/sls_detector_funcs.h @@ -1,4 +1,5 @@ #pragma once + /************************************************ * @file sls_detector_funcs.h * @short functions indices to call on server (detector/receiver) @@ -121,7 +122,7 @@ enum detFuncs{ NUM_REC_FUNCTIONS }; - +#ifdef __cplusplus static const char* getFunctionNameFromEnum(enum detFuncs func) { switch (func) { case F_EXEC_COMMAND: return "F_EXEC_COMMAND"; @@ -237,5 +238,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) { case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS"; default: return "Unknown Function"; } -} +}; +#endif