Explorar el Código

fixing memory problems

Stasik0 hace 9 años
padre
commit
fb32f7e8ec
Se han modificado 1 ficheros con 1 adiciones y 2 borrados
  1. 1 2
      src/server/ua_subscription.c

+ 1 - 2
src/server/ua_subscription.c

@@ -147,8 +147,7 @@ void Subscription_updateNotifications(UA_Subscription *subscription) {
             changeNotification = UA_malloc(sizeof(UA_DataChangeNotification));
             changeNotification = UA_malloc(sizeof(UA_DataChangeNotification));
 	
 	
             // Create one DataChangeNotification for each queue item held in each monitoredItems queue:
             // Create one DataChangeNotification for each queue item held in each monitoredItems queue:
-            changeNotification->monitoredItems =
-                UA_malloc(sizeof(UA_MonitoredItemNotification) * monItemsChangeT);
+            changeNotification->monitoredItems = UA_Array_new(&UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION], monItemsChangeT);
 	
 	
             // Scan all monitoredItems in this subscription and have their queue transformed into an Array of
             // Scan all monitoredItems in this subscription and have their queue transformed into an Array of
             // the propper NotificationMessageType (Status, Change, Event)
             // the propper NotificationMessageType (Status, Change, Event)