From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 18:06:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51D43106568B; Mon, 13 Oct 2008 18:06:34 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FEC18FC1E; Mon, 13 Oct 2008 18:06:34 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DI6YDj082679; Mon, 13 Oct 2008 18:06:34 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DI6Yvw082678; Mon, 13 Oct 2008 18:06:34 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200810131806.m9DI6Yvw082678@svn.freebsd.org> From: Robert Noland Date: Mon, 13 Oct 2008 18:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183834 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 18:06:34 -0000 Author: rnoland Date: Mon Oct 13 18:06:33 2008 New Revision: 183834 URL: http://svn.freebsd.org/changeset/base/183834 Log: Correct memory leak of info->rects. Previously we would free info, but but abandon info->rects. Approved by: jhb (mentor) Modified: head/sys/dev/drm/drm_drawable.c Modified: head/sys/dev/drm/drm_drawable.c ============================================================================== --- head/sys/dev/drm/drm_drawable.c Mon Oct 13 18:03:27 2008 (r183833) +++ head/sys/dev/drm/drm_drawable.c Mon Oct 13 18:06:33 2008 (r183834) @@ -74,8 +74,8 @@ int drm_adddraw(struct drm_device *dev, struct drm_draw *draw = data; struct bsd_drm_drawable_info *info; - info = drm_calloc(1, sizeof(struct bsd_drm_drawable_info), - DRM_MEM_DRAWABLE); + info = malloc(sizeof(struct bsd_drm_drawable_info), DRM_MEM_DRAWABLE, + M_NOWAIT | M_ZERO); if (info == NULL) return ENOMEM; @@ -102,8 +102,8 @@ int drm_rmdraw(struct drm_device *dev, v (struct bsd_drm_drawable_info *)info); DRM_SPINUNLOCK(&dev->drw_lock); free_unr(dev->drw_unrhdr, draw->handle); - drm_free(info, sizeof(struct bsd_drm_drawable_info), - DRM_MEM_DRAWABLE); + free(info->rects, DRM_MEM_DRAWABLE); + free(info, DRM_MEM_DRAWABLE); return 0; } else { DRM_SPINUNLOCK(&dev->drw_lock); @@ -126,9 +126,7 @@ int drm_update_draw(struct drm_device *d case DRM_DRAWABLE_CLIPRECTS: DRM_SPINLOCK(&dev->drw_lock); if (update->num != info->num_rects) { - drm_free(info->rects, - sizeof(*info->rects) * info->num_rects, - DRM_MEM_DRAWABLE); + free(info->rects, DRM_MEM_DRAWABLE); info->rects = NULL; info->num_rects = 0; } @@ -137,8 +135,8 @@ int drm_update_draw(struct drm_device *d return 0; } if (info->rects == NULL) { - info->rects = drm_alloc(sizeof(*info->rects) * - update->num, DRM_MEM_DRAWABLE); + info->rects = malloc(sizeof(*info->rects) * + update->num, DRM_MEM_DRAWABLE, M_NOWAIT); if (info->rects == NULL) { DRM_SPINUNLOCK(&dev->drw_lock); return ENOMEM; @@ -167,8 +165,8 @@ void drm_drawable_free_all(struct drm_de (struct bsd_drm_drawable_info *)info); DRM_SPINUNLOCK(&dev->drw_lock); free_unr(dev->drw_unrhdr, info->handle); - drm_free(info, sizeof(struct bsd_drm_drawable_info), - DRM_MEM_DRAWABLE); + free(info->info.rects, DRM_MEM_DRAWABLE); + free(info, DRM_MEM_DRAWABLE); DRM_SPINLOCK(&dev->drw_lock); } DRM_SPINUNLOCK(&dev->drw_lock);