Преглед на файлове

fix(client): Fix a false positive of clang-analyzer

Julius Pfrommer преди 5 години
родител
ревизия
689b26cd14
променени са 1 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 3 1
      src/client/ua_client_subscriptions.c

+ 3 - 1
src/client/ua_client_subscriptions.c

@@ -499,13 +499,14 @@ __MonitoredItems_create_handler(UA_Client *client, void *d, UA_UInt32 requestId,
     /* Add internally */
     for(size_t i = 0; i < request->itemsToCreateSize; i++) {
         if(response->results[i].statusCode != UA_STATUSCODE_GOOD) {
-            if (deleteCallbacks[i])
+            if(deleteCallbacks[i])
                 deleteCallbacks[i](client, sub->subscriptionId, sub->context, 0, contexts[i]);
             UA_free(mis[i]);
             mis[i] = NULL;
             continue;
         }
 
+        UA_assert(mis[i] != NULL);
         UA_Client_MonitoredItem *newMon = mis[i];
         newMon->clientHandle = request->itemsToCreate[i].requestedParameters.clientHandle;
         newMon->monitoredItemId = response->results[i].monitoredItemId;
@@ -522,6 +523,7 @@ __MonitoredItems_create_handler(UA_Client *client, void *d, UA_UInt32 requestId,
                      sub->subscriptionId, newMon->clientHandle);
         mis[i] = NULL;
     }
+
 cleanup:
     MonitoredItems_CreateData_deleteItems(data, client);
     if(cc->isAsync) {