From 1000d88ddfcd0ae769125db37d4e78643a430caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 15 Jun 2007 10:10:33 +0200 Subject: Fix memory leaks in vblank error paths. Also use drm_calloc instead of drm_alloc and memset, and use the size of the struct instead of the size of the pointer for allocation... --- shared-core/i915_irq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'shared-core') diff --git a/shared-core/i915_irq.c b/shared-core/i915_irq.c index e91add9d..ad2cf9c2 100644 --- a/shared-core/i915_irq.c +++ b/shared-core/i915_irq.c @@ -707,7 +707,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) return DRM_ERR(EBUSY); } - vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER); + vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER); if (!vbl_swap) { DRM_ERROR("Failed to allocate memory to queue swap\n"); @@ -717,8 +717,10 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) DRM_DEBUG("\n"); ret = drm_vblank_get(dev, pipe); - if (ret) + if (ret) { + drm_free(vbl_swap, sizeof(*vbl_swap), DRM_MEM_DRIVER); return ret; + } vbl_swap->drw_id = swap.drawable; vbl_swap->pipe = pipe; -- cgit v1.2.3