Messages in this thread Patch in this message | | | Date | Mon, 6 Dec 1999 18:31:52 +0000 | From | Jens Axboe <> | Subject | Re: memory leak in sr_ioctl.c in Linux 2.2.12/13 |
| |
On Mon, Dec 06 1999, Martin Vogt wrote: > Hello, > > The following program produces a few EINVAL errors > and then only ENOMEM erros, because the file > sr_ioctl.c has a memory leak. > > (It does not free the memory, when returning EINVAL)
Ouch! Alan, here's the simple fix against 2.2.14-pre11.
-- * Jens Axboe <axboe@image.dk> * Linux CD-ROM Maintainer * http://www.kernel.dk --- sr_ioctl.c~ Mon Dec 6 18:28:18 1999 +++ sr_ioctl.c Mon Dec 6 18:30:02 1999 @@ -750,8 +750,11 @@ lba = (((msf.cdmsf_min0 * CD_SECS) + msf.cdmsf_sec0) * CD_FRAMES + msf.cdmsf_frame0) - CD_MSF_OFFSET; - if (lba < 0 || lba >= scsi_CDs[target].capacity) + + if (lba < 0 || lba >= scsi_CDs[target].capacity) { + scsi_free(raw); return -EINVAL; + } rc = sr_read_sector(target, lba, blocksize, raw); if (!rc) | |