summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-06-15 10:10:33 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2007-06-15 10:10:33 +0200
commit1000d88ddfcd0ae769125db37d4e78643a430caf (patch)
tree0a2e0b1b0e362017df0925a443105ec1367f19b0 /linux-core
parentb06268294afb47e62949984d73905344dd160262 (diff)
Fix memory leaks in vblank error paths.
Also use drm_calloc instead of drm_alloc and memset, and use the size of the struct instead of the size of the pointer for allocation...
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_irq.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index 7bdb01b2..f73d067f 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -518,18 +518,19 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
- if (!
- (vbl_sig =
- drm_alloc(sizeof(drm_vbl_sig_t), DRM_MEM_DRIVER))) {
+ vbl_sig = drm_calloc(1, sizeof(drm_vbl_sig_t), DRM_MEM_DRIVER);
+ if (!vbl_sig) {
return -ENOMEM;
}
ret = drm_vblank_get(dev, crtc);
- if (ret)
+ if (ret) {
+ drm_free(vbl_sig, sizeof(drm_vbl_sig_t),
+ DRM_MEM_DRIVER);
return ret;
- atomic_inc(&dev->vbl_signal_pending);
+ }
- memset((void *)vbl_sig, 0, sizeof(*vbl_sig));
+ atomic_inc(&dev->vbl_signal_pending);
vbl_sig->sequence = vblwait.request.sequence;
vbl_sig->info.si_signo = vblwait.request.signal;