aboutsummaryrefslogtreecommitdiff
path: root/src/keys.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-10-20 14:47:11 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-10-20 14:47:11 +0200
commit98221f4e3640b2522851e49c7f81f5e500ed4a25 (patch)
treef1dc9608ec61cfb2d73a64580589b6746a04c198 /src/keys.c
parent8e2699e16139c8efdc54a06471de29966ccc233a (diff)
downloadlibssh-98221f4e3640b2522851e49c7f81f5e500ed4a25.tar.gz
libssh-98221f4e3640b2522851e49c7f81f5e500ed4a25.tar.xz
libssh-98221f4e3640b2522851e49c7f81f5e500ed4a25.zip
Fixed a bunch of smallish bugs
http://linuxtesting.org/upstream-tracker/test_results/libssh/current/test_results.html for a whole list
Diffstat (limited to 'src/keys.c')
-rw-r--r--src/keys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/keys.c b/src/keys.c
index 9f5a49f8..7b82d95f 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -329,7 +329,7 @@ ssh_public_key publickey_from_privatekey(ssh_private_key prv) {
if (key == NULL) {
return NULL;
}
-
+ ZERO_STRUCTP(key);
key->type = prv->type;
switch(key->type) {
case SSH_KEYTYPE_DSS:
@@ -466,6 +466,9 @@ ssh_public_key publickey_from_privatekey(ssh_private_key prv) {
}
#endif
break;
+ default:
+ publickey_free(key);
+ return NULL;
}
key->type_c = ssh_type_to_char(prv->type);
@@ -715,7 +718,8 @@ ssh_string publickey_to_string(ssh_public_key key) {
ssh_string_fill(ret, buffer_get_rest(buf), buffer_get_rest_len(buf));
error:
ssh_buffer_free(buf);
- ssh_string_free(type);
+ if(type != NULL)
+ ssh_string_free(type);
return ret;
}