Fix memory leak in libssh2_knownhost_add.

This commit is contained in:
Alexander Lamaison 2010-03-07 16:18:46 +00:00
parent b3556c2e0c
commit f87f4ab836

View File

@ -158,9 +158,11 @@ libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts,
"entry"); "entry");
/* make sure we have a key type set */ /* make sure we have a key type set */
if(!(typemask & LIBSSH2_KNOWNHOST_KEY_MASK)) if(!(typemask & LIBSSH2_KNOWNHOST_KEY_MASK)) {
return libssh2_error(hosts->session, LIBSSH2_ERROR_INVAL, rc = libssh2_error(hosts->session, LIBSSH2_ERROR_INVAL,
"No key type set"); "No key type set");
goto error;
}
memset(entry, 0, sizeof(struct known_host)); memset(entry, 0, sizeof(struct known_host));