diff options
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c')
-rw-r--r-- | lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c b/lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c index d8628a36b..157570b80 100644 --- a/lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c +++ b/lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c @@ -66,7 +66,7 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc, struct renderonly *ro, struct winsys_handle *out_handle) { - struct renderonly_scanout *scanout; + struct renderonly_scanout *scanout = NULL; int err; struct drm_mode_create_dumb create_dumb = { .width = rsc->width0, @@ -114,7 +114,13 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc, return scanout; free_dumb: - destroy_dumb.handle = scanout->handle; + /* If an error occured, make sure we reset the scanout object before + * leaving. + */ + if (scanout) + memset(scanout, 0, sizeof(*scanout)); + + destroy_dumb.handle = create_dumb.handle; drmIoctl(ro->kms_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb); return NULL; |