mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
(fish_free_archive): check socket before close.
Find by Coverity. Coverity id #313668. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
1431d8b692
commit
facf199f65
@ -379,13 +379,21 @@ fish_free_archive (struct vfs_class *me, struct vfs_s_super *super)
|
||||
fish_super_t *fish_super = FISH_SUPER (super);
|
||||
|
||||
if ((fish_super->sockw != -1) || (fish_super->sockr != -1))
|
||||
{
|
||||
vfs_print_message (_("fish: Disconnecting from %s"), super->name ? super->name : "???");
|
||||
|
||||
if (fish_super->sockw != -1)
|
||||
{
|
||||
fish_command (me, super, NONE, "#BYE\nexit\n", -1);
|
||||
close (fish_super->sockw);
|
||||
close (fish_super->sockr);
|
||||
fish_super->sockw = fish_super->sockr = -1;
|
||||
fish_super->sockw = -1;
|
||||
}
|
||||
|
||||
if (fish_super->sockr != -1)
|
||||
{
|
||||
close (fish_super->sockr);
|
||||
fish_super->sockr = -1;
|
||||
}
|
||||
|
||||
g_free (fish_super->scr_ls);
|
||||
g_free (fish_super->scr_exists);
|
||||
g_free (fish_super->scr_mkdir);
|
||||
|
Loading…
Reference in New Issue
Block a user