diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2012-12-10 20:59:52 (GMT) |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2013-01-13 08:07:44 (GMT) |
commit | dd5700ea98ad0b375a72525ce7d7edddf15b2693 (patch) | |
tree | fe03dceda8c142e5d18adcb0619afeeafd3f06e9 /drivers/gpu/drm/nouveau/nouveau_drm.c | |
parent | 82c805abb20946dcb343cd607327e4d720bf6b28 (diff) | |
download | linux-fsl-qoriq-dd5700ea98ad0b375a72525ce7d7edddf15b2693.tar.xz |
drm/nouveau: fix nouveau_client allocation failure path
Depending on the point of failure, freed object would be returned
or memory leak would happen.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 01c403d..efcfefa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -84,11 +84,16 @@ nouveau_cli_create(struct pci_dev *pdev, const char *name, struct nouveau_cli *cli; int ret; + *pcli = NULL; ret = nouveau_client_create_(name, nouveau_name(pdev), nouveau_config, nouveau_debug, size, pcli); cli = *pcli; - if (ret) + if (ret) { + if (cli) + nouveau_client_destroy(&cli->base); + *pcli = NULL; return ret; + } mutex_init(&cli->mutex); return 0; |