Skip to content

Commit

Permalink
drm/i915: fix up error path leak in i915_cmdbuffer
Browse files Browse the repository at this point in the history
Commit 201361a 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: Chris Wright <chrisw@sous-sol.org>
[anholt: fixed uninit variable use introduced in original patch]
Signed-off-by: Eric Anholt <eric@anholt.net>
  • Loading branch information
Chris Wright authored and Eric Anholt committed Apr 22, 2009
1 parent d816f6a commit 355d7f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/i915_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,18 +713,18 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
mutex_unlock(&dev->struct_mutex);
if (ret) {
DRM_ERROR("i915_dispatch_cmdbuffer failed\n");
goto fail_batch_free;
goto fail_clip_free;
}

if (sarea_priv)
sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);

fail_batch_free:
drm_free(batch_data, cmdbuf->sz, DRM_MEM_DRIVER);
fail_clip_free:
drm_free(cliprects,
cmdbuf->num_cliprects * sizeof(struct drm_clip_rect),
DRM_MEM_DRIVER);
fail_batch_free:
drm_free(batch_data, cmdbuf->sz, DRM_MEM_DRIVER);

return ret;
}
Expand Down

0 comments on commit 355d7f3

Please sign in to comment.