|
#include <stdio.h>
#include "MemLeakCheck.h"
extern void AllocateManySetsOf3Pointers(int npointers);
main()
{
// allocate some memory
char *sz=malloc(100);
// then some more:
char *sz2=malloc(1000);
char *sz3=realloc(sz2,2000);
char *sz4=strdup("Hello");
char *sz5=sz4+1000;//almost certainly a wild pointer
sz3=sz3;sz=sz;//to remove level 4 warnings.
free(sz5);// attempt to free our wild pointer - should give an alert
// put this in another file to test the file names
AllocateManySetsOf3Pointers(2001);
MemLeakCheckAndFree();
getchar();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Trained as a mathematician.
Now I program shareware apps - music and 3D. Main ones so far, Fractal Tune Smithy (music) and Virtual Flower (3D / VRML).