Explorar el Código

remove an issue uncovered by clang analyzer

Julius Pfrommer hace 9 años
padre
commit
f940c9660a
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      src/ua_types.c

+ 4 - 0
src/ua_types.c

@@ -178,6 +178,10 @@ UA_Guid UA_Guid_random(void) {
 
 /* ByteString */
 UA_StatusCode UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length) {
+    if(length == 0) {
+        UA_ByteString_init(bs);
+        return UA_STATUSCODE_GOOD;
+    }
     if(!(bs->data = UA_malloc(length)))
         return UA_STATUSCODE_BADOUTOFMEMORY;
     bs->length = length;