Skip to content

Commit

Permalink
Fix memory leak by freeing options we allocated
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Oct 19, 2016
1 parent eee6d59 commit 0271705
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sassc.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,19 @@ int main(int argc, char** argv) {
break;
case 'v':
print_version();
sass_delete_options(options);
return 0;
case 'h':
print_usage(argv[0]);
sass_delete_options(options);
return 0;
case '?':
/* Unrecognized flag or missing an expected value */
/* getopt should produce it's own error message for this case */
invalid_usage(argv[0]);
default:
fprintf(stderr, "Unknown error while processing arguments\n");
sass_delete_options(options);
return 2;
}
}
Expand Down Expand Up @@ -330,5 +333,7 @@ int main(int argc, char** argv) {
result = compile_stdin(options, outfile);
}

sass_delete_options(options);

return result;
}

0 comments on commit 0271705

Please # to comment.