1
0
forked from drath/libratbag

Don't allocate zero-sized memory

Triggered by the tests with 0 resolutions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-07-10 16:51:52 +10:00
committed by Benjamin Tissoires
parent 586fc7a97d
commit 78bdfe7a59

View File

@@ -643,8 +643,9 @@ ratbag_create_profile(struct ratbag_device *device,
profile->refcount = 0;
profile->device = device;
profile->index = index;
profile->resolution.modes = zalloc(num_resolutions *
sizeof(*profile->resolution.modes));
if (num_resolutions)
profile->resolution.modes = zalloc(num_resolutions *
sizeof(*profile->resolution.modes));
profile->resolution.num_modes = num_resolutions;
profile->is_enabled = true;