1
1

knownhosts: Fix use after free

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Andreas Schneider 2019-06-12 10:17:26 +02:00
родитель 77ada9e4dc
Коммит 1a3436d7d3

Просмотреть файл

@ -775,12 +775,14 @@ int ssh_session_update_known_hosts(ssh_session session)
} else { } else {
rc = 0; rc = 0;
} }
SAFE_FREE(dir);
if (rc != 0) { if (rc != 0) {
ssh_set_error(session, SSH_FATAL, ssh_set_error(session, SSH_FATAL,
"Cannot create %s directory.", dir); "Cannot create %s directory.", dir);
SAFE_FREE(dir);
return SSH_ERROR; return SSH_ERROR;
} }
SAFE_FREE(dir);
fp = fopen(session->opts.knownhosts, "a"); fp = fopen(session->opts.knownhosts, "a");
if (fp == NULL) { if (fp == NULL) {