Bug 2171 - potential fd leak
Summary: potential fd leak
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: -current
Hardware: Other Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_6_5
  Show dependency treegraph
 
Reported: 2013-11-12 15:17 AEDT by Loganaden Velvindron
Modified: 2016-08-02 10:40 AEST (History)
1 user (show)

See Also:


Attachments
potential_fd_leak_fix (623 bytes, patch)
2013-11-12 15:18 AEDT, Loganaden Velvindron
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Loganaden Velvindron 2013-11-12 15:17:42 AEDT
in sftp-client.c:

        if (resume_flag) {
                if (fstat(local_fd, &st) == -1) {
                        error("Unable to stat local file \"%s\": %s",
                            local_path, strerror(errno));
                        goto fail;
                }
                if ((size_t)st.st_size > size) {
                        error("Unable to resume download of \"%s\": "   
                            "local file is larger than remote", local_path);    
 fail:
                        do_close(conn, handle, handle_len);
                        buffer_free(&msg);
                        free(handle);
                        return -1;

in the fail label, local_fd is not closed in case open() call was successful.
Comment 1 Loganaden Velvindron 2013-11-12 15:18:33 AEDT
Created attachment 2374 [details]
potential_fd_leak_fix
Comment 2 Damien Miller 2013-12-04 15:20:24 AEDT
applied - thanks.
Comment 3 Damien Miller 2016-08-02 10:40:50 AEST
Close all resolved bugs after 7.3p1 release