LJ Archive

Listing 4. mytest02.c Example Program

#include <stdlib.h>
char *alloc_two ()
{
        char *tmp = malloc(5005);
         // Create a memory leak
        return malloc(3300);
}
char *alloc_one ()
{
        return malloc (1100);
}
int
main ()
{
        char *mem1 = alloc_two ();
        char *mem2 = alloc_one ();
        free (mem1);
        return 0;
}
LJ Archive