mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
Ticket #4616: (tar_read_header): fix double free.
When tar data block unexpected end then header_copy get freed but
"goto ret:" freed header_copy again.
Do not free header_copy at exit from the loop of reading tar blocks.
Found by Clang-19 Static Analyzer.
The bug was introduced in 8223f82857
.
Reported-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d205be6f85
commit
152362bcb1
@ -680,7 +680,6 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive)
|
||||
data_block = tar_find_next_block (arch);
|
||||
if (data_block == NULL)
|
||||
{
|
||||
g_free (header_copy);
|
||||
message (D_ERROR, MSG_ERROR, _("Unexpected EOF on archive file"));
|
||||
status = HEADER_FAILURE;
|
||||
goto ret;
|
||||
|
Loading…
Reference in New Issue
Block a user