Skip to contentSkip to conversation

vmwgfx: memory leaks caused by double allocation

PATCH In review Dan Carpenter 2 participants 2 messages Oct 18, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmwgfx: memory leaks caused by double allocation

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

drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +1 -1
index c7cff3d..86c5e4c 100644
@@ -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;
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +1 -1
index 35d5f61..15fb260 100644
@@ -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;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

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

Quoted 26 lines
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +1 -1
index c7cff3d..86c5e4c 100644
@@ -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;
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +1 -1
index 35d5f61..15fb260 100644
@@ -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;