In a program i'm writing i need to get the MD5 hashes of two strings that are read somewhere on the system. So i wrote a method that takes a string and returns the MD5 hash using the mhash library. The first string is properly processed but when the second string is passed the mhash_init_int method results in SIGABORT being thrown.
The probleem seems to be line 319 of mhash.c:
ret = (MHASH) mutils_malloc(sizeof(MHASH_INSTANCE));
This results in SIGABORT, malloc(): memory corruption (fast).
Attached is a small test program that demonstrates the problem and lists the output and stacktrace of a run with GDB.