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

Cc: Eric Anholt <[email protected]>
Cc: Keith Packard <[email protected]>
Cc: Jesse Barnes <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
---
 drivers/gpu/drm/i915/i915_dma.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a000cf0..bc33bf1 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -674,7 +674,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void 
*data,
        drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)
            master_priv->sarea_priv;
        drm_i915_cmdbuffer_t *cmdbuf = data;
-       struct drm_clip_rect *cliprects = NULL;
+       struct drm_clip_rect *cliprects;
        void *batch_data;
        int ret;
 
@@ -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;
 }

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to