mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
pki: Check for no memory available calling ssh_key_new().
This commit is contained in:
@@ -876,6 +876,10 @@ int ssh_pki_generate(enum ssh_keytypes_e type, int parameter,
|
|||||||
int rc;
|
int rc;
|
||||||
ssh_key key = ssh_key_new();
|
ssh_key key = ssh_key_new();
|
||||||
|
|
||||||
|
if (key == NULL) {
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
key->type = type;
|
key->type = type;
|
||||||
key->type_c = ssh_key_type_to_char(type);
|
key->type_c = ssh_key_type_to_char(type);
|
||||||
key->flags = SSH_KEY_FLAG_PRIVATE | SSH_KEY_FLAG_PUBLIC;
|
key->flags = SSH_KEY_FLAG_PRIVATE | SSH_KEY_FLAG_PUBLIC;
|
||||||
|
Reference in New Issue
Block a user