public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] vmwgfx: memory leaks caused by double allocation
@ 2011-10-18  6:09 Dan Carpenter
  2011-10-18  6:37 ` Thomas Hellstrom
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-10-18  6:09 UTC (permalink / raw)
  To: David Airlie
  Cc: Thomas Hellstrom, kernel-janitors, dri-devel, Rakib Mullick,
	Dave Airlie, Andrew Morton

These variables get allocated twice so the first allocation is a
memory leak.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index c7cff3d..86c5e4c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -1255,8 +1255,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
 			     struct drm_file *file_priv)
 {
 	struct vmw_private *dev_priv = vmw_priv(dev);
-	struct vmw_user_surface *user_srf -	    kmalloc(sizeof(*user_srf), GFP_KERNEL);
+	struct vmw_user_surface *user_srf;
 	struct vmw_surface *srf;
 	struct vmw_resource *res;
 	struct vmw_resource *tmp;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 35d5f61..15fb260 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -953,8 +953,7 @@ int vmw_event_fence_action_create(struct drm_file *file_priv,
 				  uint32_t *tv_usec,
 				  bool interruptible)
 {
-	struct vmw_event_fence_action *eaction -		kzalloc(sizeof(*eaction), GFP_KERNEL);
+	struct vmw_event_fence_action *eaction;
 	struct ttm_mem_global *mem_glob  		vmw_mem_glob(fence->fman->dev_priv);
 	struct vmw_fence_manager *fman = fence->fman;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] vmwgfx: memory leaks caused by double allocation
  2011-10-18  6:09 [patch] vmwgfx: memory leaks caused by double allocation Dan Carpenter
@ 2011-10-18  6:37 ` Thomas Hellstrom
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellstrom @ 2011-10-18  6:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kernel-janitors, dri-devel, Rakib Mullick, Dave Airlie,
	Andrew Morton

On 10/18/2011 08:09 AM, Dan Carpenter wrote:
> These variables get allocated twice so the first allocation is a
> memory leak.
>
> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>
>    

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>


> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> index c7cff3d..86c5e4c 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> @@ -1255,8 +1255,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
>   			     struct drm_file *file_priv)
>   {
>   	struct vmw_private *dev_priv = vmw_priv(dev);
> -	struct vmw_user_surface *user_srf > -	    kmalloc(sizeof(*user_srf), GFP_KERNEL);
> +	struct vmw_user_surface *user_srf;
>   	struct vmw_surface *srf;
>   	struct vmw_resource *res;
>   	struct vmw_resource *tmp;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> index 35d5f61..15fb260 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> @@ -953,8 +953,7 @@ int vmw_event_fence_action_create(struct drm_file *file_priv,
>   				  uint32_t *tv_usec,
>   				  bool interruptible)
>   {
> -	struct vmw_event_fence_action *eaction > -		kzalloc(sizeof(*eaction), GFP_KERNEL);
> +	struct vmw_event_fence_action *eaction;
>   	struct ttm_mem_global *mem_glob >   		vmw_mem_glob(fence->fman->dev_priv);
>   	struct vmw_fence_manager *fman = fence->fman;
>    


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-18  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18  6:09 [patch] vmwgfx: memory leaks caused by double allocation Dan Carpenter
2011-10-18  6:37 ` Thomas Hellstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox