|
From: Wim G. <wim...@ua...> - 2003-10-08 14:18:30
|
Hi all,
I seem to be having a problem.
Running the code:
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void test()
{
char * test = "ABCDEFGHIJKLMNO";
char * piep;
piep = strdup(test);
piep = strdup(test);
printf( "%s\n", piep );
free(piep);
}
int main( int argc, char ** argv )
{
int i;
for( i = 0; i < 10000000; i++ )
{
test();
}
return 0;
}
should print out the abc... string a zillion times to the screen, while
creating memory leaks on the way.
Running this in valgrind doesn't give ANY program output, and says no
leaks are possible seeing as no malloc has been done. Apparently it
doesn't check inside strdup. This doesn't explain for the no-output
problem though.
I used:
valgrind --leak-check=yes --leak-resolution=high
Anybody have any ideas?
Thanks in advance,
Wim
|