diff --git a/.gitignore b/.gitignore index 7ade25b..90f3cdf 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ libtrdb.a tests trdb benchmarks +doc/html +doc/latex .Tpo @@ -62,4 +64,7 @@ m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 +*~ +.cache + Makefile diff --git a/src/trace_debugger.c b/src/trace_debugger.c index 0cd80f9..ede3e9e 100644 --- a/src/trace_debugger.c +++ b/src/trace_debugger.c @@ -1318,11 +1318,14 @@ static void free_section_for_debugging(struct disassemble_info *dinfo) { if (!dinfo) return; - free(dinfo->buffer); - dinfo->buffer = NULL; - dinfo->buffer_vma = 0; - dinfo->buffer_length = 0; - dinfo->section = NULL; + + if (dinfo->buffer) { + free(dinfo->buffer); + dinfo->buffer = NULL; + dinfo->buffer_vma = 0; + dinfo->buffer_length = 0; + dinfo->section = NULL; + } } /* Load the section given by @p section from @p abfd into @p dinfo. */ @@ -2063,10 +2066,16 @@ int trdb_decompress_trace(struct trdb_ctx *c, bfd *abfd, } } free_section_for_debugging(&dinfo); + if ((&dinfo)->private_data) + free((&dinfo)->private_data); + return status; fail: free_section_for_debugging(&dinfo); + if ((&dinfo)->private_data) + free((&dinfo)->private_data); + return status; }