nouveau: free in error path if drmAvailable fails.

This was reported in coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
main
Dave Airlie 2011-10-19 17:39:54 +01:00
parent d23146f3f0
commit cc088f1721
1 changed files with 3 additions and 1 deletions

View File

@ -46,8 +46,10 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
nvdev->needs_close = close; nvdev->needs_close = close;
ver = drmGetVersion(fd); ver = drmGetVersion(fd);
if (!ver) if (!ver) {
nouveau_device_close((void *)&nvdev);
return -EINVAL; return -EINVAL;
}
if ((ver->version_major == 0 && ver->version_patchlevel != 16) || if ((ver->version_major == 0 && ver->version_patchlevel != 16) ||
ver->version_major > 1) { ver->version_major > 1) {