Raymond Toy pushed to branch issue-306-lisp.c at cmucl / cmucl Commits: 11b0847b by Raymond Toy at 2024-07-24T09:15:12-07:00 Add check_ptr(cmucllib,...) Make sure that cmucllib is not NULL after we gone through all the cases to determine a value for cmucllib. - - - - - ab21364d by Raymond Toy at 2024-07-24T09:20:31-07:00 Handle leak of searched_core The initial fix of just returning NULL when `core` is NULL or when `core` is not accessible like so: ``` if (core && access(core, R_OK) != 0) { return NULL; } ``` fixed the analyzer warning that we were leaking `core`. I think the analyzer is wrong here. If `core` was set by `search_core` but it is inaccessible, we'd return NULL without freeing the space returned by search_core. Instead we do this so that we the searched core is NULL or if it's not accessible, we free the space before returning. This also fixes the analyzer warning. - - - - - 1 changed file: - src/lisp/lisp.c Changes: ===================================== src/lisp/lisp.c ===================================== @@ -451,7 +451,7 @@ locate_core(const char* cmucllib, const char* core, const char* default_core) } if (core && access(core, R_OK) != 0) { - core = NULL; + return NULL; } return core; @@ -789,6 +789,8 @@ main(int argc, const char *argv[], const char *envp[]) } } + check_ptr(cmucllib, "cmucllib must not be NULL"); + /* Only look for a core file if we're not using a built-in image. */ if (builtin_image_flag == 0) { /* View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/a21feb6f05bde430f56c880... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/a21feb6f05bde430f56c880... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)