lkml.org 
[lkml]   [1999]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 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)
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.038 / U:12.076 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site