mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
misc: Don't leak memory on ssh_path_expand_escape() on error.
(cherry picked from commit 61d032fc03)
This commit is contained in:
@@ -760,11 +760,13 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
|
|||||||
default:
|
default:
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
"Wrong escape sequence detected");
|
"Wrong escape sequence detected");
|
||||||
|
free(r);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x == NULL) {
|
if (x == NULL) {
|
||||||
ssh_set_error_oom(session);
|
ssh_set_error_oom(session);
|
||||||
|
free(r);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,6 +774,8 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
|
|||||||
if (i > MAX_BUF_SIZE) {
|
if (i > MAX_BUF_SIZE) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
"String too long");
|
"String too long");
|
||||||
|
free(x);
|
||||||
|
free(r);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user