diff options
author | Andreas Schneider <asn@cynapses.org> | 2010-09-18 20:59:29 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-09-18 20:59:29 +0200 |
commit | fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b (patch) | |
tree | 54645cd347c63b14c6d6fa87a05e554129b1ee68 /src | |
parent | f7ea9a3f27790345e9535ebe0ca01092b5be63b8 (diff) | |
download | libssh-fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b.tar.gz libssh-fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b.tar.xz libssh-fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b.zip |
pki: Fixed a possible crash.
Diffstat (limited to 'src')
-rw-r--r-- | src/pki.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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; } |