Commit c4cee69a authored by Lyude Paul's avatar Lyude Paul Committed by Ben Skeggs

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: default avatarLyude Paul <lyude@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent e15e4c13
......@@ -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 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
fail_ttm:
nouveau_vga_fini(drm);
nouveau_cli_fini(&drm->client);
fail_master:
nouveau_cli_fini(&drm->master);
fail_alloc:
kfree(drm);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment