You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
681 B

  1. #include "mnemosyne.h"
  2. static char rcsid[] = "/fats/tools/hsv/mnemosyne/mtest.c,v 1.1.1.1 1995/06/06 18:18:27 fabio Exp";
  3. /*
  4. test harness/demo of mnemosyne library. deliberately leaks memory on the
  5. floor, double frees, frees unallocated memory, etc.
  6. Marcus J. Ranum, 1990. (mjr@decuac.dec.com)
  7. */
  8. main()
  9. {
  10. char *d = "foobar";
  11. char *xx;
  12. int x;
  13. xx = malloc(922);
  14. xx = malloc(123);
  15. /* huh ? */
  16. xx = malloc(-9);
  17. /* waste some memory */
  18. for(x = 1; x < 8; x++)
  19. xx = malloc(x);
  20. /* free something we don't own */
  21. free(d);
  22. /* double free something */
  23. free(xx);
  24. free(xx);
  25. /* not necessary - this triggers a better printout of statistics */
  26. mnem_writestats();
  27. }