drm/i915: fix up error path leak in i915_cmdbuffer
authorChris Wright <chrisw@sous-sol.org>
Fri, 17 Apr 2009 01:18:55 +0000 (01:18 +0000)
committerEric Anholt <eric@anholt.net>
Wed, 22 Apr 2009 01:25:18 +0000 (18:25 -0700)
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: Chris Wright <chrisw@sous-sol.org>
[anholt: fixed uninit variable use introduced in original patch]
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_dma.c

index 2726143..051134c 100644 (file)
@@ -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;
 }