diff options
author | Robert Noland <rnoland@2hip.net> | 2008-10-10 18:23:11 -0400 |
---|---|---|
committer | Robert Noland <rnoland@2hip.net> | 2008-10-10 18:23:11 -0400 |
commit | f5327aca0cbb1b602e4f954b8f361f2e1daaf20d (patch) | |
tree | 35c1ccb216f2db74d25de01c78ca3d26cf4a1f6c /bsd-core/drm_drawable.c | |
parent | cdd3e9fc562bd57e0272e4c4d1c0707776bd01a1 (diff) |
[FreeBSD] Plug memory leak in drm_rmdraw() and drm_drawable_free_all()
Diffstat (limited to 'bsd-core/drm_drawable.c')
-rw-r--r-- | bsd-core/drm_drawable.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/bsd-core/drm_drawable.c b/bsd-core/drm_drawable.c index 018db57d..2ae11dbb 100644 --- a/bsd-core/drm_drawable.c +++ b/bsd-core/drm_drawable.c @@ -71,8 +71,8 @@ int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv) 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; @@ -99,8 +99,8 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv) (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); @@ -123,9 +123,7 @@ int drm_update_draw(struct drm_device *dev, void *data, 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; } @@ -134,8 +132,8 @@ int drm_update_draw(struct drm_device *dev, void *data, 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; @@ -164,8 +162,8 @@ void drm_drawable_free_all(struct drm_device *dev) (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); |