X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Foceani.mdc;h=96fe6c6d6922d82c89de66d37ce0375667a02f04;hp=0334af198c9656e7f261beb6e773c838aeda2a8a;hb=4e45f3adc25339d51b05281710c046591be9dd6e;hpb=b880d8942e1539875d8209e18bf3d21011220ff8 diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index 0334af1..96fe6c6 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -176,7 +176,7 @@ structures can be used. int fd; int len; char *file; - struct section *s, *ss; + struct section *s = NULL, *ss; char *section = NULL; struct parse_context context = { .config = { @@ -231,13 +231,13 @@ structures can be used. if (!ss) { fprintf(stderr, "oceani: cannot find section %s\n", section); - exit(1); + goto cleanup; } } else ss = s; // NOTEST if (!ss->code) { fprintf(stderr, "oceani: no code found in requested section\n"); // NOTEST - exit(1); // NOTEST + goto cleanup; // NOTEST } parse_oceani(ss->code, &context.config, dotrace ? stderr : NULL); @@ -254,7 +254,7 @@ structures can be used. } if (doexec && !context.parse_error) interp_main(&context, argc - optind, argv + optind); - + cleanup: while (s) { struct section *t = s->next; code_free(s->code);