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:
committed by
Benjamin Tissoires
parent
586fc7a97d
commit
78bdfe7a59
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user