summaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-02-14 03:22:58 +0000
committerEric Anholt <anholt@freebsd.org>2005-02-14 03:22:58 +0000
commit2f7cd38c122b2f7f790e51b78a51cc935c9b2f18 (patch)
tree997ed854e1edd359d700325ecf7b4f9678319515 /shared-core
parent650c0fe391b09479afd787e0b1db0a3e22cc4fcd (diff)
Initialize kbuf to NULL to quiet the compiler about uninit variables
(wasn't an issue). Don't forget to free kbuf if the copyin fails.
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/radeon_state.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c
index 883d1d0e..1e606f3b 100644
--- a/shared-core/radeon_state.c
+++ b/shared-core/radeon_state.c
@@ -2725,7 +2725,7 @@ static int radeon_cp_cmdbuf(DRM_IOCTL_ARGS)
drm_radeon_cmd_buffer_t cmdbuf;
drm_radeon_cmd_header_t header;
int orig_nbox, orig_bufsz;
- char *kbuf;
+ char *kbuf = NULL;
LOCK_TEST_WITH_RETURN(dev, filp);
@@ -2756,8 +2756,10 @@ static int radeon_cp_cmdbuf(DRM_IOCTL_ARGS)
kbuf = drm_alloc(cmdbuf.bufsz, DRM_MEM_DRIVER);
if (kbuf == NULL)
return DRM_ERR(ENOMEM);
- if (DRM_COPY_FROM_USER(kbuf, cmdbuf.buf, cmdbuf.bufsz))
+ if (DRM_COPY_FROM_USER(kbuf, cmdbuf.buf, cmdbuf.bufsz)) {
+ drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER);
return DRM_ERR(EFAULT);
+ }
cmdbuf.buf = kbuf;
}