From fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 18 Sep 2010 20:59:29 +0200 Subject: pki: Fixed a possible crash. --- src/pki.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pki.c b/src/pki.c index ef925dd0..fc15a2c8 100644 --- a/src/pki.c +++ b/src/pki.c @@ -34,10 +34,13 @@ /** * @brief creates a new empty SSH key - * @returns an empty ssh_key handle + * @returns an empty ssh_key handle, or NULL on error. */ -ssh_key ssh_key_new (void){ - ssh_key ptr=malloc (sizeof (struct ssh_key_struct)); +ssh_key ssh_key_new (void) { + ssh_key ptr = malloc (sizeof (struct ssh_key_struct)); + if (ptr == NULL) { + return NULL; + } ZERO_STRUCTP(ptr); return ptr; } -- cgit v1.2.3