aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-09-18 20:59:29 +0200
committerAndreas Schneider <asn@cynapses.org>2010-09-18 20:59:29 +0200
commitfe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b (patch)
tree54645cd347c63b14c6d6fa87a05e554129b1ee68 /src
parentf7ea9a3f27790345e9535ebe0ca01092b5be63b8 (diff)
downloadlibssh-fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b.tar.gz
libssh-fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b.tar.xz
libssh-fe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b.zip
pki: Fixed a possible crash.
Diffstat (limited to 'src')
-rw-r--r--src/pki.c9
1 files changed, 6 insertions, 3 deletions
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;
}