{
/* Find the smallest width alignment that gives us a 64byte aligned stride */
unsigned blk_sz = util_format_get_blocksize(rsc->format);
+ struct renderonly_scanout *scanout = NULL;
assert(blk_sz);
if (create_dumb.pitch % 64)
goto free_dumb;
- struct renderonly_scanout *scanout;
-
simple_mtx_lock(&ro->bo_map_lock);
scanout = util_sparse_array_get(&ro->bo_map, create_dumb.handle);
simple_mtx_unlock(&ro->bo_map_lock);
return scanout;
free_dumb:
+ /* 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);