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

Commits:

1 changed file:

Changes:

  • src/lisp/lisp.c
    ... ... @@ -442,16 +442,24 @@ fpu_mode_t fpu_mode = SSE2;
    442 442
     static const char*
    
    443 443
     locate_core(const char* cmucllib, const char* core, const char* default_core)
    
    444 444
     {
    
    445
    +    char* searched_core = NULL;
    
    446
    +    
    
    445 447
         if (core == NULL) {
    
    446 448
             if (getenv("CMUCLCORE") == NULL) {
    
    447
    -            core = search_core(cmucllib, default_core);
    
    449
    +            searched_core = search_core(cmucllib, default_core);
    
    450
    +            core = searched_core;
    
    448 451
             } else {
    
    449 452
                 core = getenv("CMUCLCORE");
    
    450 453
             }
    
    451 454
         }
    
    452 455
     
    
    453
    -    if (core && access(core, R_OK) != 0) {
    
    454
    -      return NULL;
    
    456
    +    if (core) {
    
    457
    +        if (access(core, R_OK) != 0) {
    
    458
    +            if (searched_core) {
    
    459
    +                free(searched_core);
    
    460
    +            }
    
    461
    +            return NULL;
    
    462
    +        }
    
    455 463
         }
    
    456 464
         
    
    457 465
         return core;