diff options
Diffstat (limited to 'sftp-server.c')
-rw-r--r-- | sftp-server.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sftp-server.c b/sftp-server.c index 4eb31d94e..0c00003f8 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #include "includes.h" | 24 | #include "includes.h" |
25 | RCSID("$OpenBSD: sftp-server.c,v 1.39 2003/02/06 09:29:18 markus Exp $"); | 25 | RCSID("$OpenBSD: sftp-server.c,v 1.40 2003/03/05 22:33:43 markus Exp $"); |
26 | 26 | ||
27 | #include "buffer.h" | 27 | #include "buffer.h" |
28 | #include "bufaux.h" | 28 | #include "bufaux.h" |
@@ -158,7 +158,7 @@ handle_new(int use, char *name, int fd, DIR *dirp) | |||
158 | handles[i].use = use; | 158 | handles[i].use = use; |
159 | handles[i].dirp = dirp; | 159 | handles[i].dirp = dirp; |
160 | handles[i].fd = fd; | 160 | handles[i].fd = fd; |
161 | handles[i].name = name; | 161 | handles[i].name = xstrdup(name); |
162 | return i; | 162 | return i; |
163 | } | 163 | } |
164 | } | 164 | } |
@@ -230,9 +230,11 @@ handle_close(int handle) | |||
230 | if (handle_is_ok(handle, HANDLE_FILE)) { | 230 | if (handle_is_ok(handle, HANDLE_FILE)) { |
231 | ret = close(handles[handle].fd); | 231 | ret = close(handles[handle].fd); |
232 | handles[handle].use = HANDLE_UNUSED; | 232 | handles[handle].use = HANDLE_UNUSED; |
233 | xfree(handles[handle].name); | ||
233 | } else if (handle_is_ok(handle, HANDLE_DIR)) { | 234 | } else if (handle_is_ok(handle, HANDLE_DIR)) { |
234 | ret = closedir(handles[handle].dirp); | 235 | ret = closedir(handles[handle].dirp); |
235 | handles[handle].use = HANDLE_UNUSED; | 236 | handles[handle].use = HANDLE_UNUSED; |
237 | xfree(handles[handle].name); | ||
236 | } else { | 238 | } else { |
237 | errno = ENOENT; | 239 | errno = ENOENT; |
238 | } | 240 | } |
@@ -396,7 +398,7 @@ process_open(void) | |||
396 | if (fd < 0) { | 398 | if (fd < 0) { |
397 | status = errno_to_portable(errno); | 399 | status = errno_to_portable(errno); |
398 | } else { | 400 | } else { |
399 | handle = handle_new(HANDLE_FILE, xstrdup(name), fd, NULL); | 401 | handle = handle_new(HANDLE_FILE, name, fd, NULL); |
400 | if (handle < 0) { | 402 | if (handle < 0) { |
401 | close(fd); | 403 | close(fd); |
402 | } else { | 404 | } else { |
@@ -681,7 +683,7 @@ process_opendir(void) | |||
681 | if (dirp == NULL) { | 683 | if (dirp == NULL) { |
682 | status = errno_to_portable(errno); | 684 | status = errno_to_portable(errno); |
683 | } else { | 685 | } else { |
684 | handle = handle_new(HANDLE_DIR, xstrdup(path), 0, dirp); | 686 | handle = handle_new(HANDLE_DIR, path, 0, dirp); |
685 | if (handle < 0) { | 687 | if (handle < 0) { |
686 | closedir(dirp); | 688 | closedir(dirp); |
687 | } else { | 689 | } else { |