提交 355d7f37 编写于 作者: C Chris Wright 提交者: Eric Anholt

drm/i915: fix up error path leak in i915_cmdbuffer

Commit 201361a5 introduces a leak when unwinding on error.  Reorder
unwind, and eliminate leak.

Cc: Eric Anholt <eric@anholt.net>
Cc: Keith Packard <keithp@keithp.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: NChris Wright <chrisw@sous-sol.org>
[anholt: fixed uninit variable use introduced in original patch]
Signed-off-by: NEric Anholt <eric@anholt.net>
上级 d816f6ac
...@@ -713,18 +713,18 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, ...@@ -713,18 +713,18 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (ret) { if (ret) {
DRM_ERROR("i915_dispatch_cmdbuffer failed\n"); DRM_ERROR("i915_dispatch_cmdbuffer failed\n");
goto fail_batch_free; goto fail_clip_free;
} }
if (sarea_priv) if (sarea_priv)
sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
fail_batch_free:
drm_free(batch_data, cmdbuf->sz, DRM_MEM_DRIVER);
fail_clip_free: fail_clip_free:
drm_free(cliprects, drm_free(cliprects,
cmdbuf->num_cliprects * sizeof(struct drm_clip_rect), cmdbuf->num_cliprects * sizeof(struct drm_clip_rect),
DRM_MEM_DRIVER); DRM_MEM_DRIVER);
fail_batch_free:
drm_free(batch_data, cmdbuf->sz, DRM_MEM_DRIVER);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册