[PATCH] Fix memory leak in vc_resize/vc_allocate
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 29 Sep 2006 09:00:25 +0000 (02:00 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 16:18:14 +0000 (09:18 -0700)
commit254e948b2908dd50df9dca4e6ed14b6cc8524fc9
tree5c3e3cf8c40babc88ae772dce0c90c0c40140baa
parentbce9a234ce7d8dddbfcec28e37ea58b5d8f6003d
[PATCH] Fix memory leak in vc_resize/vc_allocate

Memory leaks can happen in the vc_resize() function in drivers/char/vt.c
because of the vc->vc_screenbuf variable overriding in vc_allocate().  The
kmemleak reported trace is as follows:

  <__kmalloc>
  <vc_resize>
  <fbcon_init>
  <visual_init>
  <vc_allocate>
  <con_open>
  <tty_open>
  <chrdev_open>

This patch no longer allocates a screen buffer in vc_allocate() if it was
already allocated by vc_resize().

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/vt.c