unix/main: Free pathbuf when there's an error opening a file.
This commit is contained in:
parent
fb8792c095
commit
94ee1b629a
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue