]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Make sure out-of-memory errors are logged to malloc.log when we're
authorSimon Tatham <anakin@pobox.com>
Wed, 27 Feb 2002 22:20:03 +0000 (22:20 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 27 Feb 2002 22:20:03 +0000 (22:20 +0000)
logging mallocs.

[originally from svn r1564]

misc.c

diff --git a/misc.c b/misc.c
index cb894b3ec1476ea419d4135b71a2bb6c5c728760..a2d741e54cbdbf5412ff5311f08c205d32d5e4f2 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -408,6 +408,8 @@ void *safemalloc(size_t size)
 #ifdef MALLOC_LOG
        sprintf(str, "Out of memory! (%s:%d, size=%d)",
                mlog_file, mlog_line, size);
+       fprintf(fp, "*** %s\n", str);
+       fclose(fp);
 #else
        strcpy(str, "Out of memory!");
 #endif
@@ -443,6 +445,8 @@ void *saferealloc(void *ptr, size_t size)
 #ifdef MALLOC_LOG
        sprintf(str, "Out of memory! (%s:%d, size=%d)",
                mlog_file, mlog_line, size);
+       fprintf(fp, "*** %s\n", str);
+       fclose(fp);
 #else
        strcpy(str, "Out of memory!");
 #endif