aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@intel.com>2015-02-26 16:23:55 -0800
committerChad Versace <chad.versace@intel.com>2015-02-26 16:26:56 -0800
commit0d71e456425ddf900073cd4408daa4c6751fbe51 (patch)
tree482413d397c8f32642b1714516a25b0fc74fbf4a
parent2bb939095c1d09c79dad5ab5da123ec77eb4ea61 (diff)
downloadwaffle-0d71e456425ddf900073cd4408daa4c6751fbe51.tar.gz
gbm: Fix crash when eglChooseConfig fails
Crash introduced by 2bb939095c1d09c79dad5ab5da123ec77eb4ea61. Also, stop calling eglChooseConfig twice. Signed-off-by: Chad Versace <chad.versace@intel.com>
-rw-r--r--src/waffle/gbm/wgbm_config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/waffle/gbm/wgbm_config.c b/src/waffle/gbm/wgbm_config.c
index be1d4e3..67470d5 100644
--- a/src/waffle/gbm/wgbm_config.c
+++ b/src/waffle/gbm/wgbm_config.c
@@ -35,14 +35,18 @@ wgbm_config_choose(struct wcore_platform *wc_plat,
struct wcore_display *wc_dpy,
const struct wcore_config_attrs *attrs)
{
- struct wcore_config *config = wegl_config_choose(wc_plat, wc_dpy, attrs);
- if (wgbm_config_get_gbm_format(wc_plat, wc_dpy, config) == 0) {
+ struct wcore_config *wc_config = wegl_config_choose(wc_plat, wc_dpy, attrs);
+ if (!wc_config)
+ return NULL;
+
+ if (wgbm_config_get_gbm_format(wc_plat, wc_dpy, wc_config) == 0) {
wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
"requested config is unsupported on GBM");
+ wegl_config_destroy(wc_config);
return NULL;
}
- return wegl_config_choose(wc_plat, wc_dpy, attrs);
+ return wc_config;
}
uint32_t