[sdlsound] Re: Valgrind testing.

Andersson Torbjorn E torbjorn.e.andersson at tietoenator.com
Mon Aug 19 02:17:54 EDT 2002

Ryan C. Gordon wrote:

> ==6295== Thread 2:
> ==6295== Invalid read of size 2
> ==6295==    at 0x40255547: rs_loop (resample.c:129)
> ==6295==    by 0x40256366: resample_voice (resample.c:542)
> ==6295==    by 0x402500B4: mix_voice (mix.c:535)
> ==6295==    by 0x40252FB4: do_compute_data (playmidi.c:611)
> ==6295==    Address 0x437C3064 is 0 bytes after a block of size 59768
> ==6295==    at 0x4004314B: malloc (vg_clientfuncs.c:100)
> ==6295==    by 0x4024C95E: safe_malloc (common.c:97)
> ==6295==    by 0x4024D82F: load_instrument (instrum.c:396)
> ==6295==    by 0x4024DFF6: fill_bank (instrum.c:555)

Ironically, I don't get this with your MIDI file, but I do get it with

I left my notes at home, but a few lines earlier it tries to determine the
of iterations for a loop, and it does something like A = B / C + 1. I wonder
that's meant to be integer division, rounding up instead of down. That'd
fail if
B % C = 0.

Looks like it does that in a few other places as well. But this is just a
Maybe it really is meant to do it that way...


TietoEnator Resource Management AB
Torbjörn Andersson

More information about the sdlsound mailing list