In drm_remove_magic, free the magic entry when it is found instead of

attempting to free a NULL reference in the error case. From Yorick Hardy.
This commit is contained in:
jmcneill 2007-03-29 11:31:06 +00:00
parent b7b1f2ee87
commit 4ce279101e
1 changed files with 2 additions and 1 deletions

View File

@ -110,13 +110,14 @@ static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
if (prev) {
prev->next = pt->next;
}
pt->priv->magic = 0;
DRM_UNLOCK();
free(pt, M_DRM);
return 0;
}
}
DRM_UNLOCK();
free(pt, M_DRM);
return DRM_ERR(EINVAL);
}