- removed remaining calls to malloc, calloc, free. Replaced by GLOBAL_.. macros.
This commit is contained in:
parent
5bc9834b74
commit
1450d84eaf
5 changed files with 16 additions and 20 deletions
|
@ -197,15 +197,15 @@ initialize(ControlObject* self)
|
|||
printf("No control model found for variable %s\n", ctlModelName);
|
||||
}
|
||||
|
||||
free(ctlModelName);
|
||||
GLOBAL_FREEMEM(ctlModelName);
|
||||
|
||||
char* sboClassName = createString(4, self->lnName, "$CF$", self->name, "$sboClass");
|
||||
|
||||
self->sboClass = MmsServer_getValueFromCache(mmsServer, self->mmsDomain, sboClassName);
|
||||
|
||||
free(sboClassName);
|
||||
GLOBAL_FREEMEM(sboClassName);
|
||||
|
||||
self->ctlObjectName = (char*) malloc(130);
|
||||
self->ctlObjectName = (char*) GLOBAL_MALLOC(130);
|
||||
|
||||
createStringInBuffer(self->ctlObjectName, 5, MmsDomain_getName(self->mmsDomain), "/",
|
||||
self->lnName, "$CO$", self->name);
|
||||
|
@ -239,8 +239,8 @@ initialize(ControlObject* self)
|
|||
if (DEBUG_IED_SERVER)
|
||||
printf("timeout for %s is %i\n", sboTimeoutName, self->selectTimeout);
|
||||
|
||||
free(controlObjectReference);
|
||||
free(sboTimeoutName);
|
||||
GLOBAL_FREEMEM(controlObjectReference);
|
||||
GLOBAL_FREEMEM(sboTimeoutName);
|
||||
}
|
||||
else {
|
||||
self->sbo = MmsValue_newVisibleString(NULL);
|
||||
|
@ -475,7 +475,7 @@ ControlObject_destroy(ControlObject* self)
|
|||
MmsValue_delete(self->emptyString);
|
||||
|
||||
if (self->ctlObjectName != NULL)
|
||||
free(self->ctlObjectName);
|
||||
GLOBAL_FREEMEM(self->ctlObjectName);
|
||||
|
||||
if (self->error != NULL)
|
||||
MmsValue_delete(self->error);
|
||||
|
@ -493,14 +493,14 @@ ControlObject_destroy(ControlObject* self)
|
|||
MmsValue_delete(self->origin);
|
||||
|
||||
if (self->name != NULL)
|
||||
free(self->name);
|
||||
GLOBAL_FREEMEM(self->name);
|
||||
|
||||
#if (CONFIG_MMS_THREADLESS_STACK != 1)
|
||||
if (self->stateLock != NULL)
|
||||
Semaphore_destroy(self->stateLock);
|
||||
#endif
|
||||
|
||||
free(self);
|
||||
GLOBAL_FREEMEM(self);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1214,10 +1214,10 @@ Control_writeAccessControlObject(MmsMapping* self, MmsDomain* domain, char* vari
|
|||
if (DEBUG_IED_SERVER)
|
||||
printf("IED_SERVER: writeAccessControlObject: %s\n", variableIdOrig);
|
||||
|
||||
char variableId[129];
|
||||
char variableId[65];
|
||||
|
||||
strncpy(variableId, variableIdOrig, 128);
|
||||
variableId[128] = 0;
|
||||
strncpy(variableId, variableIdOrig, 64);
|
||||
variableId[64] = 0;
|
||||
|
||||
char* separator = strchr(variableId, '$');
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ mmsClient_createReadNamedVariableListRequest(uint32_t invokeId, const char* doma
|
|||
ReadRequest_t* readRequest = createReadRequest(mmsPdu);
|
||||
|
||||
if (specWithResult) {
|
||||
readRequest->specificationWithResult = (BOOLEAN_t*) calloc(1, sizeof(BOOLEAN_t));
|
||||
readRequest->specificationWithResult = (BOOLEAN_t*) GLOBAL_CALLOC(1, sizeof(BOOLEAN_t));
|
||||
(*(readRequest->specificationWithResult)) = true;
|
||||
}
|
||||
else
|
||||
|
@ -339,7 +339,7 @@ mmsClient_createReadAssociationSpecificNamedVariableListRequest(
|
|||
ReadRequest_t* readRequest = createReadRequest(mmsPdu);
|
||||
|
||||
if (specWithResult) {
|
||||
readRequest->specificationWithResult = (BOOLEAN_t*) calloc(1, sizeof(BOOLEAN_t));
|
||||
readRequest->specificationWithResult = (BOOLEAN_t*) GLOBAL_CALLOC(1, sizeof(BOOLEAN_t));
|
||||
(*(readRequest->specificationWithResult)) = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -176,8 +176,6 @@ createNewDomainVariableSpecification(const char* domainId, const char* itemId)
|
|||
{
|
||||
VariableSpecification_t* varSpec = (VariableSpecification_t*) GLOBAL_CALLOC(1, sizeof(ListOfVariableSeq_t));
|
||||
|
||||
//VariableSpecification_t* varSpec = (VariableSpecification_t*) calloc(1, sizeof(VariableSpecification_t));
|
||||
|
||||
varSpec->present = VariableSpecification_PR_name;
|
||||
varSpec->choice.name.present = ObjectName_PR_domainspecific;
|
||||
varSpec->choice.name.choice.domainspecific.domainId.buf = (uint8_t*) domainId;
|
||||
|
@ -191,10 +189,8 @@ createNewDomainVariableSpecification(const char* domainId, const char* itemId)
|
|||
static void
|
||||
deleteDataElement(Data_t* dataElement)
|
||||
{
|
||||
if (dataElement == NULL ) {
|
||||
printf("deleteDataElement NULL argument\n");
|
||||
if (dataElement == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dataElement->present == Data_PR_structure) {
|
||||
int elementCount = dataElement->choice.structure->list.count;
|
||||
|
|
|
@ -51,7 +51,7 @@ MmsDevice_destroy(MmsDevice* self)
|
|||
MmsVariableSpecification_destroy(self->namedVariables[i]);
|
||||
}
|
||||
|
||||
free (self->namedVariables);
|
||||
GLOBAL_FREEMEM(self->namedVariables);
|
||||
}
|
||||
#endif /* (CONFIG_MMS_SUPPORT_VMD_SCOPE_NAMED_VARIABLES == 1) */
|
||||
|
||||
|
|
|
@ -526,7 +526,7 @@ IsoServer_waitReady(IsoServer self, unsigned int timeoutMs)
|
|||
} else {
|
||||
IsoConnection_destroy(isoConnection);
|
||||
lastConnection->next = openConnection->next;
|
||||
free(openConnection);
|
||||
GLOBAL_FREEMEM(openConnection);
|
||||
openConnection = lastConnection->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue