diff options
| author | Mark Wielaard <[email protected]> | 2020-04-26 01:20:57 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2020-04-26 02:27:01 +0200 |
| commit | 8c5bd878a940817088fd7907eb9d503ec98d3437 (patch) | |
| tree | c4a6e991b04fc920bcc4d021b82ae7e923b5b965 /libasm/asm_end.c | |
| parent | a5d73b3e51afada171da9781089cd0e8fc9f64a6 (diff) | |
libasm: Fix double fclose in asm_end.
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 if something went wrong writing
out the file.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libasm/asm_end.c')
| -rw-r--r-- | libasm/asm_end.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libasm/asm_end.c b/libasm/asm_end.c index 99e95017..3b8582fd 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -47,7 +47,7 @@ static int text_end (AsmCtx_t *ctx __attribute__ ((unused))) { - if (fclose (ctx->out.file) != 0) + if (fflush (ctx->out.file) != 0) { __libasm_seterrno (ASM_E_IOERROR); return -1; |
