funcs name only in c++, bug fix:slsdetectorusers not deleting multislsdetectorcommand object, bug fix: programfpga does not delete fpgasrc malloc if returning in failure

This commit is contained in:
maliakal_d 2018-10-12 17:37:39 +02:00
parent 8df63b7767
commit 178b832223
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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