summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-11-02 04:53:47 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-11-02 04:53:47 +0000
commitb44518130b33cadb5c1d619e9e936ae0e0dbf7cb (patch)
tree6069eb03c39fbc79808a7d94f857118cce75cbe3 /lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c
parent32aeb3c41fedbbd7b11aacfec48e8f699d16bff0 (diff)
Merge Mesa 23.1.9
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c')
-rw-r--r--lib/mesa/src/gallium/auxiliary/renderonly/renderonly.c10
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;