Dev/server malloc check (#1023)

* usleep in communication to actually relay the err message of memory allocation to the client (weird but test for now), function in server to handle memory allcoation issues (updates mess, ret and sendsit to the client and returns prior from function implementatin, setting fnum in client for the speicific functions that send to detector each argument separtely, they need to remember the fnum else they throw with the incorrect fnum
* server: every malloc must check if it succeeded, rearranging so that the free is clear as well (only in funcs so far)
* fixed malloc checks in other places other than funcs.c
This commit is contained in:
2024-11-18 09:46:21 +01:00
committed by GitHub
parent 5088e5a205
commit e1497f9cb9
14 changed files with 353 additions and 282 deletions

View File

@ -57,11 +57,19 @@ int Feb_Control_FebControl(int normal) {
Feb_Control_externalEnableMode = 0;
Feb_Control_subFrameMode = 0;
Feb_Control_trimbit_size = 263680;
Feb_Control_last_downloaded_trimbits =
malloc(Feb_Control_trimbit_size * sizeof(int));
if (Feb_Control_last_downloaded_trimbits == NULL) {
LOG(logERROR,
("Could not allocate memory for last downloaded trimbits\n"));
return 0;
}
Feb_Control_normal = normal;
Feb_Interface_SetAddress(Feb_Control_rightAddress, Feb_Control_leftAddress);
if (!Feb_Interface_SetAddress(Feb_Control_rightAddress,
Feb_Control_leftAddress))
return 0;
if (Feb_Control_activated) {
return Feb_Interface_SetByteOrder();
}