drm/nouveau: fix memory leak
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Fri, 11 Sep 2015 09:30:56 +0000 (15:00 +0530)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 3 Nov 2015 05:02:18 +0000 (15:02 +1000)
If pm_runtime_get_sync() we were going to "out" but we missed freeing
vma.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_gem.c

index 6bf1a7895708e8b4292900fad601599a1e5887da..a108cc37512aba5194d534660e55b61391b40c1d 100644 (file)
@@ -84,8 +84,10 @@ nouveau_gem_object_open(struct drm_gem_object *gem, struct drm_file *file_priv)
                }
 
                ret = pm_runtime_get_sync(dev);
-               if (ret < 0 && ret != -EACCES)
+               if (ret < 0 && ret != -EACCES) {
+                       kfree(vma);
                        goto out;
+               }
 
                ret = nouveau_bo_vma_add(nvbo, cli->vm, vma);
                if (ret)