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 /apps | |
| parent | 368e89e3bc88446c8fac3d5cfca266061f4e77fb (diff) | |
| download | rockbox-d46d24332f3a16fa736def96a717e1648441161a.zip rockbox-d46d24332f3a16fa736def96a717e1648441161a.tar.gz rockbox-d46d24332f3a16fa736def96a717e1648441161a.tar.bz2 rockbox-d46d24332f3a16fa736def96a717e1648441161a.tar.xz | |
fix leak-file-handles.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28330 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -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 392fc36..5088187 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) { int rat, srat, nrat; /* for rate selection */ int cont = 1, butt; + int ret; long tim = 0; static const char* bstrg[] = { "64", "80", "96", "112", "128", "160", "192", "224", "256", "320" @@ -2544,7 +2545,8 @@ enum plugin_status plugin_start(const void* parameter) if(cont) { - if(wave_open() == 0) + ret = wave_open(); + if(ret == 0) { init_mp3_encoder_engine(true, brate[srat], cfg.samplerate); get_mp3_filename(wav_filename); @@ -2557,11 +2559,12 @@ enum plugin_status plugin_start(const void* parameter) rb->close(wavfile); rb->close(mp3file); + rb->reload_directory(); } else { rb->close(wavfile); - rb->lcd_putsxyf(0, 20, "WaveOpen failed %d", wave_open()); + rb->lcd_putsxyf(0, 20, "WaveOpen failed %d", ret); rb->lcd_update(); rb->sleep(5*HZ); } diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index e2db398..cd27c92 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c @@ -123,6 +123,7 @@ static int wav2wv(const char *infile) if (rb->read (in_fd, &raw_header, sizeof (raw_header)) != sizeof (raw_header)) { rb->splash(HZ*2, "could not read file!"); + rb->close (in_fd); return true; } @@ -135,6 +136,7 @@ static int wav2wv(const char *infile) rb->strncmp (native_header.data_ckID, "data", 4) || native_header.FormatTag != 1 || native_header.BitsPerSample != 16) { rb->splash(HZ*2, "incompatible wav file!"); + rb->close (in_fd); return true; } @@ -266,6 +268,7 @@ static int wav2wv(const char *infile) else rb->splash(HZ*3, "operation successful"); + rb->reload_directory(); return error; } @@ -290,6 +293,5 @@ enum plugin_status plugin_start(const void *parameter) #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); #endif - /* Return PLUGIN_USB_CONNECTED to force a file-tree refresh */ - return PLUGIN_USB_CONNECTED; + return PLUGIN_OK; } |