From 0687c0a4ec78730f752cee04a5b0862f47dbf026 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Fri, 22 Aug 2008 21:34:25 -0400 Subject: [FreeBSD] Fix long standing memory leak in drm_remove_magic. We shuffled all the links around to disconnect the entry, but never free it. We would incorrectly free the last entry in the hash chain if nothing matched. --- bsd-core/drm_auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bsd-core/drm_auth.c') diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index f3aafe44..60af16cb 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -117,11 +117,11 @@ static int drm_remove_magic(struct drm_device *dev, drm_magic_t magic) if (prev) { prev->next = pt->next; } + free(pt, M_DRM); return 0; } } - free(pt, M_DRM); return EINVAL; } -- cgit v1.2.3 From 71f0a3e389efb6c92a84299d05beb2a1bfa53469 Mon Sep 17 00:00:00 2001 From: vehemens Date: Fri, 29 Aug 2008 12:47:00 -0400 Subject: [FreeBSD] Replace typedefs on bsd. Signed-off-by: Robert Noland --- bsd-core/drm_auth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bsd-core/drm_auth.c') diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index 60af16cb..c11c887a 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -136,7 +136,7 @@ static int drm_remove_magic(struct drm_device *dev, drm_magic_t magic) int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) { static drm_magic_t sequence = 0; - drm_auth_t *auth = data; + struct drm_auth *auth = data; /* Find unique magic */ if (file_priv->magic) { @@ -167,7 +167,7 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_authmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_auth_t *auth = data; + struct drm_auth *auth = data; drm_file_t *priv; DRM_DEBUG("%u\n", auth->magic); -- cgit v1.2.3 From 76dd74c64ef9b92025e76dd256e0641ff6fce0f4 Mon Sep 17 00:00:00 2001 From: vehemens Date: Tue, 2 Sep 2008 04:57:36 -0700 Subject: Style white space cleanup. Signed-off-by: Robert Noland --- bsd-core/drm_auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bsd-core/drm_auth.c') diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index c11c887a..2f836189 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -138,7 +138,7 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) static drm_magic_t sequence = 0; struct drm_auth *auth = data; - /* Find unique magic */ + /* Find unique magic */ if (file_priv->magic) { auth->magic = file_priv->magic; } else { -- cgit v1.2.3 From 0808cf923d4a851b100d9b7022cb82f5e1f52e28 Mon Sep 17 00:00:00 2001 From: vehemens Date: Sat, 6 Sep 2008 14:16:51 -0700 Subject: Style white space cleanup part 2. Signed-off-by: Robert Noland --- bsd-core/drm_auth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bsd-core/drm_auth.c') diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index 2f836189..455a7164 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -75,7 +75,8 @@ static int drm_add_magic(struct drm_device *dev, drm_file_t *priv, hash = drm_hash_magic(magic); entry = malloc(sizeof(*entry), M_DRM, M_ZERO | M_NOWAIT); - if (!entry) return ENOMEM; + if (!entry) + return ENOMEM; entry->magic = magic; entry->priv = priv; entry->next = NULL; -- cgit v1.2.3 From 8ca06eb492f861dbf049a2e104e4e2a5ba814c13 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Wed, 17 Sep 2008 23:10:15 -0400 Subject: [FreeBSD] Convert to using cdevpriv for file_priv tracking --- bsd-core/drm_auth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bsd-core/drm_auth.c') diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index 455a7164..b5fc5587 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -43,7 +43,7 @@ static int drm_hash_magic(drm_magic_t magic) /** * Returns the file private associated with the given magic number. */ -static drm_file_t *drm_find_file(struct drm_device *dev, drm_magic_t magic) +static struct drm_file *drm_find_file(struct drm_device *dev, drm_magic_t magic) { drm_magic_entry_t *pt; int hash = drm_hash_magic(magic); @@ -63,7 +63,7 @@ static drm_file_t *drm_find_file(struct drm_device *dev, drm_magic_t magic) * Inserts the given magic number into the hash table of used magic number * lists. */ -static int drm_add_magic(struct drm_device *dev, drm_file_t *priv, +static int drm_add_magic(struct drm_device *dev, struct drm_file *priv, drm_magic_t magic) { int hash; @@ -169,7 +169,7 @@ int drm_authmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_auth *auth = data; - drm_file_t *priv; + struct drm_file *priv; DRM_DEBUG("%u\n", auth->magic); -- cgit v1.2.3