Minor fixes to limit memory used by wma scanner

This commit is contained in:
Ron Pedde 2006-07-29 06:31:30 +00:00
parent fe4742b026
commit 714af4c9ce
2 changed files with 11 additions and 4 deletions

View File

@ -438,6 +438,7 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3) {
return FALSE;
for(index = 0; index < descriptor_count; index++) {
DPRINTF(E_DBG,L_SCAN,"Reading descr %d of %d\n",index,descriptor_count);
if(!wma_file_read_short(fd,&descriptor_name_len)) return -1;
if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name)) return -1;
if(!wma_file_read_short(fd,&descriptor_value_type)) {
@ -462,9 +463,14 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3) {
DPRINTF(E_DBG,L_SCAN,"Type: string, value: %s\n",descriptor_byte_value);
break;
case 0x0001: /* byte array */
if(!wma_file_read_bytes(fd,descriptor_value_len,
(unsigned char **)&descriptor_byte_value)){
fail=1;
if(descriptor_value_len > 4096) {
lseek(fd,descriptor_value_len,SEEK_CUR);
descriptor_byte_value = NULL;
} else {
if(!wma_file_read_bytes(fd,descriptor_value_len,
(unsigned char **)&descriptor_byte_value)){
fail=1;
}
}
DPRINTF(E_DBG,L_SCAN,"Type: bytes\n");
break;
@ -492,6 +498,7 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3) {
}
if(fail) {
DPRINTF(E_DBG,L_SCAN,"Read fail on file\n");
free(descriptor_name);
return FALSE;
}

View File

@ -2,7 +2,7 @@ CC=gcc
CFLAGS := $(CFLAGS) -g -I/opt/local/include -DHAVE_CONFIG_H -I. -I.. -DHOST='"foo"' -DHAVE_SQL -DHAVE_CONFIG_H
LDFLAGS := $(LDFLAGS) -L/opt/local/lib -lid3tag -logg -lvorbisfile -lFLAC -lvorbis -ltag_c -lsqlite -lsqlite3 -lm -framework CoreFoundation
TARGET = scanner
OBJECTS=scanner-driver.o restart.o err.o scan-aif.o scan-wma.o scan-aac.o scan-wav.o scan-flac.o scan-ogg.o scan-mp3.o scan-url.o scan-mpc.o os-unix.o conf.o ll.o xml-rpc.o webserver.o uici.o rend-win32.o configfile.o db-generic.o db-sql-sqlite3.o db-sql-sqlite2.o db-sql.o smart-parser.o plugin.o dispatch.o dynamic-art.o
OBJECTS=scanner-driver.o restart.o err.o scan-aif.o scan-wma.o scan-aac.o scan-wav.o scan-flac.o scan-ogg.o scan-mp3.o scan-url.o scan-mpc.o os-unix.o conf.o ll.o xml-rpc.o webserver.o uici.o rend-win32.o configfile.o db-generic.o db-sql-sqlite3.o db-sql-sqlite2.o db-sql.o smart-parser.o plugin.o dispatch.o dynamic-art.o db-sql-updates.o
$(TARGET): $(OBJECTS)
$(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS)