We might jump to "out" early on error. Then filelist might not be set yet
and we might try to free garbage. Set it to the null_file early.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
+2015-06-06 Mark Wielaard <mjw@redhat.com>
+
+ * dwarf_getsrclines.c (read_srclines): Initialize filelist early.
+
2015-05-27 Mark Wielaard <mjw@redhat.com>
* encoded-value.h (read_encoded_value): Check data d_size contains
size_t nfilelist = 0;
unsigned int ndirlist = 0;
+ struct filelist null_file =
+ {
+ .info =
+ {
+ .name = "???",
+ .mtime = 0,
+ .length = 0
+ },
+ .next = NULL
+ };
+ struct filelist *filelist = &null_file;
+
/* If there are a large number of lines, files or dirs don't blow up
the stack. Stack allocate some entries, only dynamically malloc
when more than MAX. */
fl; })
/* Now read the files. */
- struct filelist null_file =
- {
- .info =
- {
- .name = "???",
- .mtime = 0,
- .length = 0
- },
- .next = NULL
- };
- struct filelist *filelist = &null_file;
nfilelist = 1;
if (unlikely (linep >= lineendp))