diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2010-10-23 12:40:07 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2010-10-23 12:40:07 +0000 |
commit | d46d24332f3a16fa736def96a717e1648441161a (patch) | |
tree | afc9e1e6958d32651bfcac79ceefefc689d3afb8 | |
parent | 368e89e3bc88446c8fac3d5cfca266061f4e77fb (diff) | |
download | rockbox-d46d24332f3a16fa736def96a717e1648441161a.tar.gz rockbox-d46d24332f3a16fa736def96a717e1648441161a.zip |
fix leak-file-handles.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28330 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/mp3_encoder.c | 7 | ||||
-rw-r--r-- | apps/plugins/wav2wv.c | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index 392fc36d31..5088187b76 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c | |||
@@ -2491,6 +2491,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
2491 | { | 2491 | { |
2492 | int rat, srat, nrat; /* for rate selection */ | 2492 | int rat, srat, nrat; /* for rate selection */ |
2493 | int cont = 1, butt; | 2493 | int cont = 1, butt; |
2494 | int ret; | ||
2494 | long tim = 0; | 2495 | long tim = 0; |
2495 | static const char* bstrg[] = { | 2496 | static const char* bstrg[] = { |
2496 | "64", "80", "96", "112", "128", "160", "192", "224", "256", "320" | 2497 | "64", "80", "96", "112", "128", "160", "192", "224", "256", "320" |
@@ -2544,7 +2545,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
2544 | 2545 | ||
2545 | if(cont) | 2546 | if(cont) |
2546 | { | 2547 | { |
2547 | if(wave_open() == 0) | 2548 | ret = wave_open(); |
2549 | if(ret == 0) | ||
2548 | { | 2550 | { |
2549 | init_mp3_encoder_engine(true, brate[srat], cfg.samplerate); | 2551 | init_mp3_encoder_engine(true, brate[srat], cfg.samplerate); |
2550 | get_mp3_filename(wav_filename); | 2552 | get_mp3_filename(wav_filename); |
@@ -2557,11 +2559,12 @@ enum plugin_status plugin_start(const void* parameter) | |||
2557 | 2559 | ||
2558 | rb->close(wavfile); | 2560 | rb->close(wavfile); |
2559 | rb->close(mp3file); | 2561 | rb->close(mp3file); |
2562 | rb->reload_directory(); | ||
2560 | } | 2563 | } |
2561 | else | 2564 | else |
2562 | { | 2565 | { |
2563 | rb->close(wavfile); | 2566 | rb->close(wavfile); |
2564 | rb->lcd_putsxyf(0, 20, "WaveOpen failed %d", wave_open()); | 2567 | rb->lcd_putsxyf(0, 20, "WaveOpen failed %d", ret); |
2565 | rb->lcd_update(); | 2568 | rb->lcd_update(); |
2566 | rb->sleep(5*HZ); | 2569 | rb->sleep(5*HZ); |
2567 | } | 2570 | } |
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index e2db398ef7..cd27c92699 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c | |||
@@ -123,6 +123,7 @@ static int wav2wv(const char *infile) | |||
123 | 123 | ||
124 | if (rb->read (in_fd, &raw_header, sizeof (raw_header)) != sizeof (raw_header)) { | 124 | if (rb->read (in_fd, &raw_header, sizeof (raw_header)) != sizeof (raw_header)) { |
125 | rb->splash(HZ*2, "could not read file!"); | 125 | rb->splash(HZ*2, "could not read file!"); |
126 | rb->close (in_fd); | ||
126 | return true; | 127 | return true; |
127 | } | 128 | } |
128 | 129 | ||
@@ -135,6 +136,7 @@ static int wav2wv(const char *infile) | |||
135 | rb->strncmp (native_header.data_ckID, "data", 4) || | 136 | rb->strncmp (native_header.data_ckID, "data", 4) || |
136 | native_header.FormatTag != 1 || native_header.BitsPerSample != 16) { | 137 | native_header.FormatTag != 1 || native_header.BitsPerSample != 16) { |
137 | rb->splash(HZ*2, "incompatible wav file!"); | 138 | rb->splash(HZ*2, "incompatible wav file!"); |
139 | rb->close (in_fd); | ||
138 | return true; | 140 | return true; |
139 | } | 141 | } |
140 | 142 | ||
@@ -266,6 +268,7 @@ static int wav2wv(const char *infile) | |||
266 | else | 268 | else |
267 | rb->splash(HZ*3, "operation successful"); | 269 | rb->splash(HZ*3, "operation successful"); |
268 | 270 | ||
271 | rb->reload_directory(); | ||
269 | return error; | 272 | return error; |
270 | } | 273 | } |
271 | 274 | ||
@@ -290,6 +293,5 @@ enum plugin_status plugin_start(const void *parameter) | |||
290 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 293 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
291 | rb->cpu_boost(false); | 294 | rb->cpu_boost(false); |
292 | #endif | 295 | #endif |
293 | /* Return PLUGIN_USB_CONNECTED to force a file-tree refresh */ | 296 | return PLUGIN_OK; |
294 | return PLUGIN_USB_CONNECTED; | ||
295 | } | 297 | } |