Submitted by Emergy Berger: The bug is in the hist-pthread sample application. Here's what happens on Linux with a modern glibc.
[emery@stingray histogram]$ ./hist-pthread datafiles/small.bmp
This file has 104530176 bytes of image data, 34843392 pixels
Starting pthreads histogram
*** glibc detected *** free(): invalid pointer: 0x0912a034 ***
Abort
The cause is a number of invalid frees, where the pointer passed to
free is not the beginning but rather the inside of the allocated block
(namely, inside arg). The fix is simple: get rid of the following loop
that's nearly at the end of the program.
for(i = 0; i < num_procs; i++) {
free(arg[i].red);
free(arg[i].green);
free(arg[i].blue);
}