Browse Source

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

Julius Pfrommer 5 years ago
parent
commit
689b26cd14
1 changed files with 3 additions and 1 deletions
  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) {