I have this snipest code:
When I get in the block if and I realloc memory, I end with this(output from gdb):
I have FreeBSD 8.1 stable with custom kernel.
Code:
.
.
.
while(i<=nchunks)
{
[B]if(i==nchunks)
{
nbytes=lbytes;
buffer=(char *)realloc(buffer, nbytes);
}[/B]
else
buffer = (char *)malloc(sizeof(char)*nbytes);
//printf("%i-0x%X\n", i, buffer);
out = (char*)malloc(sizeof(char)*strlen(fname)+3);
memset(buffer, '\0', nbytes);
memset(out, '\0', strlen(fname)+3);
.
.
.
Code:
Program received signal SIGSEGV, Segmentation fault.
0x00000008006f100d in _pthread_mutex_init_calloc_cb () from /lib/libc.so.7