[COMMITTED] libasm: Fix double fclose in asm_end.

2020-04-25 Thread Mark Wielaard
GCC10 -fanalyzer found a double fclose in asm_end. asm_end can call text_end, which calls fclose and checks for errors, then asm_end calls __libasm_finictx which can call fclose again (but doesn't check for errors). Call fflush in text_end instead. fflush will generate the same error fclose would i

[COMMITTED] libdw: Call Dwarf oom_handler() when malloc fails in __libdw_alloc_tail.

2020-04-25 Thread Mark Wielaard
GCC10 -fanalyzer found a possibly-NULL dereference after a failed malloc in __libdw_alloc_tail. In this case we should call the Dwarf oom_handler as is done in other places where an essential malloc call fails. The oom_handler cannot return and will likely just abort. Signed-off-by: Mark Wielaard

[COMMITTED] libdwfl: Fix double free on failure path in gzip.c.

2020-04-25 Thread Mark Wielaard
GCC10 -fanalyzer found a double free when openstream failed. When openstream fails __libdw_gunzip will call fail, which frees the state->buffer. But openstream can call zlib_fail, which will also call fail. Instead of calling zlib_fail, just return the error that zlib_fail would have returned. Sig