I suspect that you have an over/underrun on one of the buffers (x or y +100 somewhere). Use a malloc debugger. Glibc has some basic checks (set MALLOC_CHECK_=1 or 2). I just used efence, since I had it installed already. Just link it against the efence library. Or try out valgrind
. It checks out all kinds of memory corruption problems.
Are you modifing x or y (not what it points to)?
Or post code that fails. The smaller the better. Maybe someone will look at it.
I doubt a glibc malloc bug like this would live very long. But hey, ya never know. This google search
didn't pop up anything interesting. Try searching on your glibc version (execute /lib/libc.so, yeah executable library) to get the verbose details.