Pino Toscano
2018-Apr-30 11:07 UTC
[Libguestfs] [PATCH 1/4] daemon: upload: fix fd leak on lseek failure
Make sure to not leak the file descriptor in the upload() function, in case lseek() fails. --- daemon/upload.c | 1 + 1 file changed, 1 insertion(+) diff --git a/daemon/upload.c b/daemon/upload.c index 9de855f86..540a86437 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -111,6 +111,7 @@ upload (const char *filename, int flags, int64_t offset) if (lseek (fd, offset, SEEK_SET) == -1) { err = errno; ignore_value (cancel_receive ()); + close (fd); errno = err; reply_with_perror ("lseek: %s", filename); return -1; -- 2.14.3