OSDN Git Service

nouveau: free in error path if drmAvailable fails.
authorDave Airlie <airlied@redhat.com>
Wed, 19 Oct 2011 16:39:54 +0000 (17:39 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 19 Oct 2011 16:39:54 +0000 (17:39 +0100)
This was reported in coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
nouveau/nouveau_device.c

index 2ffcba6..425c5d2 100644 (file)
@@ -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) {