Mercurial > otakunoraifu
changeset 7:fa8511a21d05
Fixes somes memory leaks
author | thib |
---|---|
date | Tue, 05 Aug 2008 10:06:04 +0000 |
parents | 2c890434e30f |
children | 55b577e5f5b5 |
files | font/font_face.cc music2/koedec_ogg.cc music2/music.cc music2/wavfile.cc system/file.cc |
diffstat | 5 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/font/font_face.cc +++ b/font/font_face.cc @@ -71,6 +71,7 @@ Face::Face(const char *name_orig, int in #endif } } + delete[] name; return; }
--- a/music2/koedec_ogg.cc +++ b/music2/koedec_ogg.cc @@ -101,8 +101,12 @@ static int ogg_closefunc(void* datasourc int ogg_get_rate(FILE *stream) { OggVorbis_File vf; - ov_open(stream, &vf, NULL, 0); - return vf.vi->rate; + ov_callbacks callback(OV_CALLBACKS_DEFAULT); + callback.close_func = NULL; + ov_test_callbacks(stream, &vf, NULL, 0, callback); + int rate = vf.vi->rate; + ov_clear(&vf); + return rate; } extern char* decode_koe_ogg(AvgKoeInfo info, int* dest_len) {
--- a/music2/music.cc +++ b/music2/music.cc @@ -220,6 +220,7 @@ void WavChunk::callback(void *userdata, memcpy(stream_dup, stream, len); memset(stream, 0, len); SDL_MixAudio(stream, (Uint8*)stream_dup, len, cur_vol); + delete[] stream_dup; return; } @@ -290,7 +291,7 @@ void MuSys::PlayKoe(const char* path) { } if (playing_koedata) { - delete[] playing_koedata; + free(playing_koedata); playing_koedata = 0; }
--- a/music2/wavfile.cc +++ b/music2/wavfile.cc @@ -352,7 +352,7 @@ WAVFILE_Converter::WAVFILE_Converter(WAV static int conv_wave_rate(short* in_buf, int length, int in_rate, int out_rate, char* tmpbuf); WAVFILE_Converter::~WAVFILE_Converter() { if (cvt) { - if (cvt->buf) delete cvt->buf; + if (cvt->buf) delete[] cvt->buf; delete cvt; cvt = 0; }
--- a/system/file.cc +++ b/system/file.cc @@ -526,6 +526,7 @@ void SCN2kFILE::ListupFiles(int fname_le arc_atom.push_back(atom); sprintf(sbuf, "seen%04d.txt",i); sbuf += 13; } + delete[] buf; fclose(stream); return; } @@ -1533,6 +1534,7 @@ bool G00CONV::Read_Type2(char* image) { } } delete[] uncompress_data; + delete[] region_table; return true; }