2018-10-31 Nathan Sidwell <nathan@acm.org>
+ * directives.c (do_include_common): Commonize cleanup path.
+ (_cpp_pop_buffer): Fix leak.
+
* include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New
predicates.
(IS_ADHOC_LOC): Move earlier.
fname = parse_include (pfile, &angle_brackets, &buf, &location);
if (!fname)
- {
- if (buf)
- XDELETEVEC (buf);
- return;
- }
+ goto done;
if (!*fname)
- {
- cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
- "empty filename in #%s",
- pfile->directive->name);
- XDELETEVEC (fname);
- if (buf)
- XDELETEVEC (buf);
- return;
- }
+ {
+ cpp_error_with_line (pfile, CPP_DL_ERROR, location, 0,
+ "empty filename in #%s",
+ pfile->directive->name);
+ goto done;
+ }
/* Prevent #include recursion. */
if (pfile->line_table->depth >= CPP_STACK_MAX)
_cpp_stack_include (pfile, fname, angle_brackets, type, location);
}
+ done:
XDELETEVEC (fname);
if (buf)
XDELETEVEC (buf);
_cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
}
+ else if (to_free)
+ free ((void *)to_free);
}
/* Enter all recognized directives in the hash table. */