Various minor fixes/improvements (#239)
Includes:
- Making "rpm_data_free" a public method and using it where appropriate
- Includes fixing memory leak in epics demo application
(note Valgrind indicates that there are more...)
- Fix typo in cov.c
- Allow NULL max_apdu parameter to address_get_by_device
- Add missing include to s_cov.h
This commit is contained in:
+2
-1
@@ -299,7 +299,8 @@ static void MyReadPropertyMultipleAckHandler(uint8_t *service_request,
|
|||||||
} else {
|
} else {
|
||||||
if (len < 0) { /* Eg, failed due to no segmentation */
|
if (len < 0) { /* Eg, failed due to no segmentation */
|
||||||
Error_Detected = true;
|
Error_Detected = true;
|
||||||
}
|
}
|
||||||
|
rpm_data_free(rpm_data);
|
||||||
free(rpm_data);
|
free(rpm_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-15
@@ -142,21 +142,8 @@ static void My_Read_Property_Multiple_Ack_Handler(uint8_t *service_request,
|
|||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
while (rpm_data) {
|
while (rpm_data) {
|
||||||
rpm_ack_print_data(rpm_data);
|
rpm_ack_print_data(rpm_data);
|
||||||
rpm_property = rpm_data->listOfProperties;
|
rpm_data = rpm_data_free(rpm_data);
|
||||||
while (rpm_property) {
|
|
||||||
value = rpm_property->value;
|
|
||||||
while (value) {
|
|
||||||
old_value = value;
|
|
||||||
value = value->next;
|
|
||||||
free(old_value);
|
|
||||||
}
|
|
||||||
old_rpm_property = rpm_property;
|
|
||||||
rpm_property = rpm_property->next;
|
|
||||||
free(old_rpm_property);
|
|
||||||
}
|
|
||||||
old_rpm_data = rpm_data;
|
|
||||||
rpm_data = rpm_data->next;
|
|
||||||
free(old_rpm_data);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "RPM Ack Malformed! Freeing memory...\n");
|
fprintf(stderr, "RPM Ack Malformed! Freeing memory...\n");
|
||||||
|
|||||||
@@ -521,7 +521,9 @@ bool address_get_by_device(
|
|||||||
if ((pMatch->Flags & BAC_ADDR_BIND_REQ) == 0) {
|
if ((pMatch->Flags & BAC_ADDR_BIND_REQ) == 0) {
|
||||||
/* If bound then fetch data */
|
/* If bound then fetch data */
|
||||||
bacnet_address_copy(src, &pMatch->address);
|
bacnet_address_copy(src, &pMatch->address);
|
||||||
*max_apdu = pMatch->max_apdu;
|
if (max_apdu) {
|
||||||
|
*max_apdu = pMatch->max_apdu;
|
||||||
|
}
|
||||||
/* Prove we found it */
|
/* Prove we found it */
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ void rpm_ack_print_data(BACNET_READ_ACCESS_DATA *rpm_data)
|
|||||||
* @param rpm_data - #BACNET_READ_ACCESS_DATA
|
* @param rpm_data - #BACNET_READ_ACCESS_DATA
|
||||||
* @return RPM data from the next element in the linked list
|
* @return RPM data from the next element in the linked list
|
||||||
*/
|
*/
|
||||||
static BACNET_READ_ACCESS_DATA *rpm_data_free(BACNET_READ_ACCESS_DATA *rpm_data)
|
BACNET_READ_ACCESS_DATA *rpm_data_free(BACNET_READ_ACCESS_DATA *rpm_data)
|
||||||
{
|
{
|
||||||
BACNET_READ_ACCESS_DATA *old_rpm_data = NULL;
|
BACNET_READ_ACCESS_DATA *old_rpm_data = NULL;
|
||||||
BACNET_PROPERTY_REFERENCE *rpm_property = NULL;
|
BACNET_PROPERTY_REFERENCE *rpm_property = NULL;
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ extern "C" {
|
|||||||
BACNET_STACK_EXPORT
|
BACNET_STACK_EXPORT
|
||||||
void rpm_ack_print_data(
|
void rpm_ack_print_data(
|
||||||
BACNET_READ_ACCESS_DATA * rpm_data);
|
BACNET_READ_ACCESS_DATA * rpm_data);
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
BACNET_READ_ACCESS_DATA *rpm_data_free(
|
||||||
|
BACNET_READ_ACCESS_DATA *rpm_data);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "bacnet/bacenum.h"
|
#include "bacnet/bacenum.h"
|
||||||
#include "bacnet/apdu.h"
|
#include "bacnet/apdu.h"
|
||||||
#include "bacnet/cov.h"
|
#include "bacnet/cov.h"
|
||||||
|
#include "bacnet/npdu.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
+1
-1
@@ -768,7 +768,7 @@ void cov_data_value_list_link(
|
|||||||
* @param value_list - #BACNET_PROPERTY_VALUE with at least 2 entries
|
* @param value_list - #BACNET_PROPERTY_VALUE with at least 2 entries
|
||||||
* @param value - REAL present-value
|
* @param value - REAL present-value
|
||||||
* @param in_alarm - value of in-alarm status-flags
|
* @param in_alarm - value of in-alarm status-flags
|
||||||
* @param fault - value of in-alarm status-flags
|
* @param fault - value of fault status-flags
|
||||||
* @param overridden - value of overridden status-flags
|
* @param overridden - value of overridden status-flags
|
||||||
* @param out_of_service - value of out-of-service status-flags
|
* @param out_of_service - value of out-of-service status-flags
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user