malloc(): memory corruption error

Hi all

Could anyone please tell me why do I get this error when I try to add another simple string type variable to the struct?

*** glibc detected *** ./run-64bit: malloc(): memory corruption: 0x00000000008d2500 ***

Thanks
It's because you're corrupting some memory.

As a general rule of thumb, to see this you are doing something (reading/writing/freeing) memory that is not yours.

If you're running under Linux, run your code again, but with the command 'valgrind' on the front, to run it under the excellent valgrind memchecker, which will often identify where you're going wrong (you may have to install valgrind, but it's available in many common repositories).
Hello Moschops

I am very for sorry a late reply.

I have installed the valgrind and ran the program with it but it shows many many lines which are all above my head. I have been searching for google about a tutorial and have found one. I will read it soon.

Many thanks :)
If you build a debug version (i.e. with debug symbols, which under gcc is done with the '-g' switch) the valgrind messages will be a bit more helpful.
Thank you once again Moschops :)
Topic archived. No new replies allowed.