From bfa568e448133501cdb496b3caea2282c7430b85 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 7 Oct 2012 22:04:58 +0200 Subject: [PATCH] pki: Check for no memory available calling ssh_key_new(). --- src/pki.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pki.c b/src/pki.c index de8d72b0..03af5b6e 100644 --- a/src/pki.c +++ b/src/pki.c @@ -876,6 +876,10 @@ int ssh_pki_generate(enum ssh_keytypes_e type, int parameter, int rc; ssh_key key = ssh_key_new(); + if (key == NULL) { + return SSH_ERROR; + } + key->type = type; key->type_c = ssh_key_type_to_char(type); key->flags = SSH_KEY_FLAG_PRIVATE | SSH_KEY_FLAG_PUBLIC;