Mercurial > otakunoraifu
diff music2/koedec_ogg.cc @ 7:fa8511a21d05
Fixes somes memory leaks
author | thib |
---|---|
date | Tue, 05 Aug 2008 10:06:04 +0000 |
parents | 422f3cb3614b |
children | 4d7486cb20a9 |
line wrap: on
line diff
--- 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) {