2003-03-07 16:18:03

by Oleg Drokin

[permalink] [raw]
Subject: [2.5] memleak in drivers/char/vt.c

Hello!

Seems there is a memleak on error exit path in drivers/char/vt.c in current bk,
here's the patch. Found with help of smatch + enhanced unfree script.


===== drivers/char/vt.c 1.34 vs edited =====
--- 1.34/drivers/char/vt.c Fri Mar 7 08:27:16 2003
+++ edited/drivers/char/vt.c Fri Mar 7 19:25:45 2003
@@ -747,8 +747,10 @@
screenbuf_size = new_screen_size;

err = resize_screen(currcons, new_cols, new_rows);
- if (err)
+ if (err) {
+ kfree(newscreen);
return err;
+ }

rlth = min(old_row_size, new_row_size);
rrem = new_row_size - rlth;

Bye,
Oleg