ソースを参照

fixing memory problems

Stasik0 10 年 前
コミット
fb32f7e8ec
共有1 個のファイルを変更した1 個の追加2 個の削除を含む
  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)