mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
unix/main: Free pathbuf when there's an error opening a file.
This commit is contained in:
@@ -699,6 +699,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
||||
char *basedir = realpath(argv[a], pathbuf);
|
||||
if (basedir == NULL) {
|
||||
mp_printf(&mp_stderr_print, "%s: can't open file '%s': [Errno %d] %s\n", argv[0], argv[a], errno, strerror(errno));
|
||||
free(pathbuf);
|
||||
// CPython exits with 2 in such case
|
||||
ret = 2;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user