From cc088f1721eaa5f8f1ba1932723882f92e34c39a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 19 Oct 2011 17:39:54 +0100 Subject: nouveau: free in error path if drmAvailable fails. This was reported in coverity. Signed-off-by: Dave Airlie --- nouveau/nouveau_device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nouveau') diff --git a/nouveau/nouveau_device.c b/nouveau/nouveau_device.c index 2ffcba6f..425c5d29 100644 --- a/nouveau/nouveau_device.c +++ b/nouveau/nouveau_device.c @@ -46,8 +46,10 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close, nvdev->needs_close = close; ver = drmGetVersion(fd); - if (!ver) + if (!ver) { + nouveau_device_close((void *)&nvdev); return -EINVAL; + } if ((ver->version_major == 0 && ver->version_patchlevel != 16) || ver->version_major > 1) { -- cgit v1.2.3