drm/nouveau: Fix potential memory leak in nouveau_drm_load()

We forget to free drm in all instances of failure, and additionally also
forget to destroy the master client if the other client fails
initialization.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Lyude Paul 2018-08-22 21:40:06 -04:00 committed by Ben Skeggs
parent e15e4c13e5
commit c4cee69a44

View File

@ -538,11 +538,11 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
ret = nouveau_cli_init(drm, "DRM-master", &drm->master);
if (ret)
return ret;
goto fail_alloc;
ret = nouveau_cli_init(drm, "DRM", &drm->client);
if (ret)
return ret;
goto fail_master;
dev->irq_enabled = true;
@ -605,7 +605,9 @@ fail_bios:
fail_ttm:
nouveau_vga_fini(drm);
nouveau_cli_fini(&drm->client);
fail_master:
nouveau_cli_fini(&drm->master);
fail_alloc:
kfree(drm);
return ret;
}