aboutsummaryrefslogtreecommitdiffstats
path: root/tests/serd_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-06-21 17:38:11 +0200
committerDavid Robillard <d@drobilla.net>2020-06-21 18:06:25 +0200
commitbc084355754ec7cec21e8f5fec9462c84805dda8 (patch)
tree0405bd36b92ef8187db07c128dae44be37418572 /tests/serd_test.c
parentd1867d49399c1a73f108c6bf8df8183984bbe03a (diff)
downloadserd-bc084355754ec7cec21e8f5fec9462c84805dda8.tar.gz
serd-bc084355754ec7cec21e8f5fec9462c84805dda8.tar.bz2
serd-bc084355754ec7cec21e8f5fec9462c84805dda8.zip
Cleanup: Avoid malloc of 0 bytes
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r--tests/serd_test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 9650dfc5..6fa4849b 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -244,7 +244,7 @@ static void
test_blob_to_node(void)
{
for (size_t size = 0; size < 256; ++size) {
- uint8_t* data = (uint8_t*)malloc(size);
+ uint8_t* data = size > 0 ? (uint8_t*)malloc(size) : NULL;
for (size_t i = 0; i < size; ++i) {
data[i] = (uint8_t)(rand() % 256);
}