Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KIO Extras
Commits
ac49e5de
Commit
ac49e5de
authored
Apr 06, 2022
by
Harald Sitter
🏳️🌈
Browse files
sftp: guard sftp_close it's not safe to call with nullptrs
BUG: 447527
parent
cb52ad98
Pipeline
#160979
passed with stage
in 1 minute and 29 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
sftp/kio_sftp.cpp
View file @
ac49e5de
...
...
@@ -1195,7 +1195,9 @@ Result SFTPInternal::truncate(KIO::filesize_t length)
void
SFTPInternal
::
close
()
{
sftp_close
(
mOpenFile
);
if
(
mOpenFile
)
{
sftp_close
(
mOpenFile
);
}
mOpenFile
=
nullptr
;
}
...
...
@@ -1265,10 +1267,10 @@ Result SFTPInternal::sftpGet(const QUrl &url, KIO::fileoffset_t offset, int fd)
// Open file
file
=
sftp_open
(
mSftp
,
path
.
constData
(),
O_RDONLY
,
0
);
const
auto
fileFree
=
qScopeGuard
([
file
]
{
sftp_close
(
file
);
});
if
(
file
==
nullptr
)
{
return
Result
::
fail
(
KIO
::
ERR_CANNOT_OPEN_FOR_READING
,
url
.
toString
());
}
const
auto
fileFree
=
qScopeGuard
([
file
]
{
sftp_close
(
file
);
});
if
(
const
Result
result
=
sftpSendMimetype
(
file
,
url
);
!
result
.
success
)
{
return
result
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment