core/iwasm/aot/aot_loader.c: Fix a zero-sized malloc warning (#1108)

Fix the following warning when loading an aot file without relocations:
```
[20:19:00:528 - 1119F1600]: warning: wasm_runtime_malloc with size zero
```
This commit is contained in:
YAMAMOTO Takashi 2022-04-20 19:27:13 +09:00 committed by GitHub
parent a85f982297
commit 67d6a2886e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2063,10 +2063,12 @@ load_relocation_section(const uint8 *buf, const uint8 *buf_end,
goto fail; goto fail;
} }
symbols = loader_malloc((uint64)sizeof(*symbols) * symbol_count, error_buf, if (symbol_count > 0) {
error_buf_size); symbols = loader_malloc((uint64)sizeof(*symbols) * symbol_count,
if (symbols == NULL) { error_buf, error_buf_size);
goto fail; if (symbols == NULL) {
goto fail;
}
} }
#if defined(BH_PLATFORM_WINDOWS) #if defined(BH_PLATFORM_WINDOWS)