home *** CD-ROM | disk | FTP | other *** search
- // BUG_MEM.C -- Program with an (obvious bug) -- fails to
- // check for NULL return from malloc().
- //
- // By linking with -OFFSET 1000h we can have 386|DOS-Extender
- // automatically detect the resulting NULL pointer dereference
- // for us.
- //
- #include <malloc.h>
-
- int main()
- {
- char *p;
-
- for (;;)
- {
- p = malloc(0x10000);
- *p = 'x';
- }
- return 0;
- }
-