summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorJan Blunck <j.blunck@tu-harburg.de>2005-08-23 22:25:14 +0200
committerChris Wright <chrisw@osdl.org>2005-08-29 09:55:13 -0700
commitec3b77ec116cf2b9d42f6544caa71f084cfc1ff1 (patch)
tree4dce860a2e4a886e5d2bbed3a44a8215e5ebe42c /init
parent7b1bfbc0786fdc9ba511d0136f6417736bdc4cc6 (diff)
[PATCH] sg.c: fix a memory leak in devices seq_file implementation (2nd)
I know that scsi procfs is legacy code but this is a fix for a memory leak. While reading through sg.c I realized that the implementation of /proc/scsi/sg/devices with seq_file is leaking memory due to freeing the pointer returned by the next() iterator method. Since next() might return NULL or an error this is wrong. This patch fixes it through using the seq_files private field for holding the reference to the iterator object. Here is a small bash script to trigger the leak. Use slabtop to watch the size-32 usage grow and grow. #!/bin/sh while true; do cat /proc/scsi/sg/devices > /dev/null done Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de> Signed-off-by: Chris Wright <chrisw@osdl.org>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions