Explorar o código

Additional error checking if initialization fails

Stefan Profanter %!s(int64=7) %!d(string=hai) anos
pai
achega
448e4e100c
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      tests/fuzz/fuzz_binary_message.cc

+ 5 - 0
tests/fuzz/fuzz_binary_message.cc

@@ -17,6 +17,11 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
     UA_Connection c = createDummyConnection(65535, NULL);
     UA_ServerConfig *config = UA_ServerConfig_new_default();
     UA_Server *server = UA_Server_new(config);
+    if (server == NULL) {
+        UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER,
+                     "Could not create server instance using UA_Server_new");
+        return 1;
+    }
 
     // we need to copy the message because it will be freed in the processing function
     UA_ByteString msg = UA_ByteString();