From 4ce279101e46fd6bfacef29f3f6062a05c138ad6 Mon Sep 17 00:00:00 2001 From: jmcneill Date: Thu, 29 Mar 2007 11:31:06 +0000 Subject: [PATCH] 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. --- sys/dev/drm/drm_auth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/drm/drm_auth.c b/sys/dev/drm/drm_auth.c index 704f9dc1b5c1..f5f7ae49e45a 100644 --- a/sys/dev/drm/drm_auth.c +++ b/sys/dev/drm/drm_auth.c @@ -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); }