mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-29 02:10:12 +01:00
modetest: fix Segmentation fault
If use -P option without -s option, the program segfaults due to dev.mode.bo being NULL. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> [Emil Velikov: Tweak the commit message.] Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
b1d19de764
commit
4e4d79d4ca
1 changed files with 8 additions and 1 deletions
|
|
@ -1119,6 +1119,12 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
|
|||
dev->mode.fb_id = fb_id;
|
||||
}
|
||||
|
||||
static void clear_mode(struct device *dev)
|
||||
{
|
||||
if (dev->mode.bo)
|
||||
bo_destroy(dev->mode.bo);
|
||||
}
|
||||
|
||||
static void set_planes(struct device *dev, struct plane_arg *p, unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
|
|
@ -1642,7 +1648,8 @@ int main(int argc, char **argv)
|
|||
if (test_cursor)
|
||||
clear_cursors(&dev);
|
||||
|
||||
bo_destroy(dev.mode.bo);
|
||||
if (count)
|
||||
clear_mode(&dev);
|
||||
}
|
||||
|
||||
free_resources(dev.resources);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue