X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=misc.c;h=6f2d5448dee146ede4d7111fc08455cc2d152c32;hb=949cecd569fc1f6876f35cb19a067462add74ab8;hp=cb894b3ec1476ea419d4135b71a2bb6c5c728760;hpb=5eeff974fde2255913ccc310ca1acacaa1bd147c;p=PuTTY.git diff --git a/misc.c b/misc.c index cb894b3e..6f2d5448 100644 --- a/misc.c +++ b/misc.c @@ -294,7 +294,7 @@ static void *minefield_alloc(int size) /* * Update the admin region. */ - for (i = start + 2; i < start + npages - 1; i++) + for (i = start + 2; i < start + npages + 1; i++) minefield_admin[i] = 0xFFFE; /* used but no region starts here */ minefield_admin[start + 1] = region_start % PAGESIZE; @@ -408,12 +408,14 @@ 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 MessageBox(NULL, str, "PuTTY Fatal Error", MB_SYSTEMMODAL | MB_ICONERROR | MB_OK); - exit(1); + cleanup_exit(1); } #ifdef MALLOC_LOG if (fp) @@ -443,12 +445,14 @@ 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 MessageBox(NULL, str, "PuTTY Fatal Error", MB_SYSTEMMODAL | MB_ICONERROR | MB_OK); - exit(1); + cleanup_exit(1); } #ifdef MALLOC_LOG if (fp)