diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2015-05-27 10:33:41 +0300 |
---|---|---|
committer | Thomas Wood <thomas.wood@intel.com> | 2015-09-25 11:42:14 +0100 |
commit | 571942f0c43451b48b0d47d80c70ff2808908317 (patch) | |
tree | d63e453b4970ac735099191dd29194b706d982c0 /tests/testdisplay.c | |
parent | 93f1250013c6c2533f840820a62a717aa33dbd88 (diff) |
testdisplay: Fix segfault after first modeset fails
When testing all modes on a connector with a single mode, if the modeset
fails, the code attempts to remove fb_info[-1], because old_fb still has
the inital value of -1.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90625
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'tests/testdisplay.c')
-rw-r--r-- | tests/testdisplay.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/testdisplay.c b/tests/testdisplay.c index ddc575de..5f7ab1dd 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -364,6 +364,7 @@ set_mode(struct connector *c) if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0, &c->id, 1, &c->mode)) { igt_warn("failed to set mode (%dx%d@%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno)); + igt_remove_fb(drm_fd, &fb_info[current_fb]); continue; } @@ -387,7 +388,7 @@ set_mode(struct connector *c) } } - if (test_all_modes) + if (test_all_modes && old_fb != -1) igt_remove_fb(drm_fd, &fb_info[old_fb]); drmModeFreeEncoder(c->encoder); |