diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2015-04-13 17:32:14 +0900 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2015-04-28 11:27:18 +0100 |
commit | 4e4d79d4cae92c5ec29882cea9b8f7e8355f1232 (patch) | |
tree | 5f5d903829cb64ba91e1faf98d1846e38196d5ca /tests/modetest | |
parent | b1d19de76468fdb4ae7cb87791c77d1f8839a573 (diff) |
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>
Diffstat (limited to 'tests/modetest')
-rw-r--r-- | tests/modetest/modetest.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index e646790b..966c2b66 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -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); |