MESSAGE
DATE | 2004-04-21 |
FROM | Billy
|
SUBJECT | Subject: [hangout] [billy@mail.dadadada.net: cdparanoia: minor memory leak]
|
This 'minor' severity bug may not end up on the Debian package website.
----- Forwarded message from Billy -----
From: Billy To: Debian Bug Tracking System Subject: cdparanoia: minor memory leak Envelope-to: billy-at-mail.dadadada.net Delivery-date: Wed, 21 Apr 2004 14:26:41 -0400 X-Spam-Status: No, hits=-3.2 required=5.0 tests=UNIFIED_PATCH,NO_MX_FOR_FROM version=2.20 X-Spam-Level:
Package: cdparanoia Version: 3a9.8-6 Severity: minor Tags: patch
There's a leak in cdda_find_a_cdrom(). A buffer is allocated via copystring() for each attempt at filling the '?' wildcard in the cdrom_devices list. This buffer is never freed. Also, the buffer is allocated once per pattern attempt, which isn't really necessary, so I changed that while I was in there. I also changed the magic numbers 48 and 97 to '0' and 'a' for clarity's sake.
diff -ru cdparanoia-3a9.8/interface/scan_devices.c cdparanoia/interface/scan_devices.c --- cdparanoia-3a9.8/interface/scan_devices.c Wed Apr 21 11:41:25 2004 +++ cdparanoia/interface/scan_devices.c Wed Apr 21 11:51:49 2004 -at--at- -65,21 +65,16 -at--at- char *pos; if((pos=strchr(cdrom_devices[i],'?'))){ int j; - /* try first eight of each device */ - for(j=0;j<4;j++){ - char *buffer=copystring(cdrom_devices[i]); - + /* try 0->4 and a->d for each device */ + char *buffer=copystring(cdrom_devices[i]); + for(j=0;j<8;j++){ /* number, then letter */ - - buffer[pos-(cdrom_devices[i])]=j+48; - if((d=cdda_identify(buffer,messagedest,messages))) - return(d); - idmessage(messagedest,messages,"",NULL); - buffer[pos-(cdrom_devices[i])]=j+97; + buffer[pos-(cdrom_devices[i])]=(j>>1)+(j&1)?'a':'0'; if((d=cdda_identify(buffer,messagedest,messages))) return(d); idmessage(messagedest,messages,"",NULL); } + free(buffer); }else{ /* Name. Go for it. */ if((d=cdda_identify(cdrom_devices[i],messagedest,messages)))
-- System Information Debian Release: 3.0 Architecture: i386 Kernel: Linux mail 2.2.20 #1 Sat Apr 20 11:45:28 EST 2002 i586 Locale: LANG=C, LC_CTYPE=C
Versions of packages cdparanoia depends on: ii libcdparanoia0 3a9.8-6 Shared libraries for cdparanoia (r
----- End forwarded message ----- ____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|