Raymond Toy pushed to branch issue-306-lisp.c at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/lisp/lisp.c
    ... ... @@ -45,7 +45,7 @@
    45 45
     
    
    46 46
     
    
    47 47
     static void
    
    48
    -check_ptr(void* ptr, const char* msg)
    
    48
    +check_ptr(const void* ptr, const char* msg)
    
    49 49
     {
    
    50 50
         if (ptr == NULL) {
    
    51 51
             perror(msg);
    
    ... ... @@ -276,6 +276,8 @@ default_cmucllib(const char *argv0arg)
    276 276
     	/* Create the colon separated list of directories */
    
    277 277
     
    
    278 278
     	defpath = malloc(total_len + 1);
    
    279
    +        check_ptr(defpath, "No space for cmucllib path");
    
    280
    +        
    
    279 281
     	*defpath = '\0';
    
    280 282
     
    
    281 283
     	ptr = cmucllib_search_list;
    
    ... ... @@ -395,6 +397,8 @@ prepend_core_path(const char *lib, const char *corefile)
    395 397
         }
    
    396 398
     
    
    397 399
         result = malloc(strlen(path) + strlen(lib) + 2);
    
    400
    +    check_ptr(result, "No space final core path");
    
    401
    +    
    
    398 402
         strcpy(result, path);
    
    399 403
         strcat(result, ":");
    
    400 404
         strcat(result, lib);
    
    ... ... @@ -748,12 +752,14 @@ main(int argc, const char *argv[], const char *envp[])
    748 752
          */
    
    749 753
         if (lib != NULL) {
    
    750 754
     	cmucllib = strdup(lib);
    
    755
    +        check_ptr(cmucllib, "No space for strdup(lib)");
    
    751 756
         } else {
    
    752 757
     	char *libvar;
    
    753 758
     
    
    754 759
     	libvar = getenv("CMUCLLIB");
    
    755 760
     	if (libvar != NULL) {
    
    756 761
     	    cmucllib = strdup(libvar);
    
    762
    +            check_ptr(cmucllib, "No space for strdup(libvar)");
    
    757 763
     	} else {
    
    758 764
     	    /*
    
    759 765
                  * The following doesn't make sense for executables.  They
    
    ... ... @@ -784,7 +790,6 @@ main(int argc, const char *argv[], const char *envp[])
    784 790
             }
    
    785 791
         }
    
    786 792
     
    
    787
    -
    
    788 793
         /* Only look for a core file if we're not using a built-in image. */
    
    789 794
         if (builtin_image_flag == 0) {
    
    790 795
     	/*