• Tycho Andersen's avatar
    unix: handle unlink failure correctly · 40a37ae7
    Tycho Andersen authored
    Instead of returning, we should revert the cwd as in all the other error
    paths.
    
    *** CID 164720:  Resource leaks  (RESOURCE_LEAK)
    /criu/sk-unix.c: 1030 in bind_unix_sk()
    1024                                    goto done;
    1025                            }
    1026                    }
    1027
    1028                    if (ui->ue->deleted && unlink((char
    *)ui->ue->name.data) < 0) {
    1029                            pr_perror("failed to unlink %s\n",
    ui->ue->name.data);
    >>> >>>     CID 164720:  Resource leaks  (RESOURCE_LEAK)
    >>> >>>     Handle variable "cwd_fd" going out of scope leaks the handle.
    1030                            return -1;
    1031                    }
    1032            }
    1033
    1034            if (ui->ue->state != TCP_LISTEN)
    1035                    futex_set_and_wake(&ui->prepared, 1);
    Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
    CC: Andrew Vagin <avagin@virtuozzo.com>
    Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    40a37ae7
sk-unix.c 33.3 KB