X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=main.c;h=78293d6d7615a3682a6153ff6b221381e5dc44cf;hb=8d5e7190261d2ed0f214ef175d8451df3dbd4dc8;hp=74d927daf98187ef4bff8cff4983d20ee341d0e9;hpb=033cf7c7d397c3fdc23a1448b0068000219efef6;p=xonotic%2Fgmqcc.git diff --git a/main.c b/main.c index 74d927d..78293d6 100644 --- a/main.c +++ b/main.c @@ -21,8 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include -#include #include #include @@ -559,7 +557,6 @@ static bool progs_nextline(char **out, size_t *alen, fs_file_t *src) { int main(int argc, char **argv) { size_t itr; int retval = 0; - bool opts_output_free = false; bool operators_free = false; bool progs_src = false; fs_file_t *outfile = NULL; @@ -692,8 +689,7 @@ int main(int argc, char **argv) { item.type = TYPE_QC; vec_push(items, item); } else if (!opts_output_wasset) { - OPTS_OPTION_STR(OPTION_OUTPUT) = util_strdup(line); - opts_output_free = true; + OPTS_OPTION_DUP(OPTION_OUTPUT) = util_strdup(line); hasline = true; } } @@ -782,8 +778,12 @@ cleanup: if (!OPTS_OPTION_BOOL(OPTION_PP_ONLY)) if(parser) parser_cleanup(parser); - if (opts_output_free) - mem_d(OPTS_OPTION_STR(OPTION_OUTPUT)); + + /* free allocated option strings */ + for (itr = 0; itr < OPTION_COUNT; itr++) + if (OPTS_OPTION_DUPED(itr)) + mem_d(OPTS_OPTION_STR(itr)); + if (operators_free) mem_d((void*)operators);