lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [patch] allocation checks, of course


From: John Bley
Subject: lynx-dev [patch] allocation checks, of course
Date: Thu, 28 Jan 1999 23:48:20 -0500 (EST)

You know 'em, you love 'em, I live for 'em, it's a pile of missed memory 
allocation checks.
Patch against 2.8.2dev15

-- 
John Bley - address@hidden
Duke '99 - English/Computer Science
  Since English is a mess, it maps well onto the problem space,
  which is also a mess, which we call reality.     - Larry Wall

--- LYUtils.c.orig      Thu Jan 28 23:19:31 1999
+++ LYUtils.c   Thu Jan 28 23:39:48 1999
@@ -2975,6 +2975,8 @@
      * Rename any temporary files.
      */
     temp = (char *)calloc(1, (strlen(lynx_temp_space) + 60));
+    if (temp == NULL) 
+       outofmem(__FILE__, "change_sug_filename");
     cp = wwwName(lynx_temp_space);
     if (LYIsHtmlSep(*cp)) {
        sprintf(temp, "file://localhost%s%d", cp, (int)getpid());
@@ -5024,6 +5026,8 @@
             */
            char *temp = (char *)calloc(1,
                                        (strlen(home) + strlen(file) + 10));
+           if (temp == NULL)
+               outofmem(__FILE__, "LYAddPathToHome");
            sprintf(temp, "%s%s", HTVMS_wwwName(home), (file + 1));
            sprintf(fbuffer, "%.*s",
                    (fbuffer_size - 1), HTVMS_name("", temp));
@@ -5696,6 +5700,8 @@
        StrAllocCopy((p->name), result);
        p->file = fp;
        ly_temp = p;
+    } else {
+       outofmem(__FILE__, "LYOpenTemp");
     }
 
     CTRACE(tfp, "... LYOpenTemp(%s)\n", result);
@@ -5741,6 +5747,8 @@
            StrAllocCopy((p->name), result);
            p->file = fp;
            ly_temp = p;
+       } else {
+           outofmem(__FILE__, "LYOpenScratch");
        }
     }
     CTRACE(tfp, "LYOpenScratch(%s)\n", result);
--- LYReadCFG.c.orig    Thu Jan 28 23:30:50 1999
+++ LYReadCFG.c Thu Jan 28 23:31:47 1999
@@ -1212,6 +1212,8 @@
                if ((q->str_value = (char **)calloc(1, sizeof(char **))) != 0) {
                        StrAllocCopy(*(q->str_value), tmpbuf);
                        putenv (*(q->str_value));
+               } else {
+                       outofmem(__FILE__, "read_cfg");
                }
 #endif
            }
--- HTInit.c.orig       Thu Jan 28 23:38:12 1999
+++ HTInit.c    Thu Jan 28 23:38:45 1999
@@ -503,7 +503,9 @@
                    return cur->result;
            return -1;
        case RTR_add:
-           cur = calloc(1, sizeof(struct cmdlist_s));
+           cur = calloc(1, sizeof(struct cmdlist_s));  
+           if (cur == NULL)
+               outofmem(__FILE__, "RememberTestResult");
            cur->next = cmdlist;
            cur->cmd = (char *)malloc(strlen(cmd) + 1);
            if(cur->cmd)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]