mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-10 18:28:10 +09:00
Don't leak memory in publickey_make_* functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@532 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -75,6 +75,7 @@ PUBLIC_KEY *publickey_make_dss(SSH_SESSION *session, BUFFER *buffer) {
|
|||||||
|
|
||||||
key = malloc(sizeof(PUBLIC_KEY));
|
key = malloc(sizeof(PUBLIC_KEY));
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
|
buffer_free(buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ error:
|
|||||||
string_free(pubkey);
|
string_free(pubkey);
|
||||||
publickey_free(key);
|
publickey_free(key);
|
||||||
|
|
||||||
return key;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, BUFFER *buffer,
|
PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, BUFFER *buffer,
|
||||||
@@ -159,6 +160,7 @@ PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, BUFFER *buffer,
|
|||||||
|
|
||||||
key = malloc(sizeof(PUBLIC_KEY));
|
key = malloc(sizeof(PUBLIC_KEY));
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
|
buffer_free(buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,6 +173,7 @@ PUBLIC_KEY *publickey_make_rsa(SSH_SESSION *session, BUFFER *buffer,
|
|||||||
key->type_c = type;
|
key->type_c = type;
|
||||||
e = buffer_get_ssh_string(buffer);
|
e = buffer_get_ssh_string(buffer);
|
||||||
n = buffer_get_ssh_string(buffer);
|
n = buffer_get_ssh_string(buffer);
|
||||||
|
|
||||||
buffer_free(buffer); /* we don't need it anymore */
|
buffer_free(buffer); /* we don't need it anymore */
|
||||||
|
|
||||||
if(e == NULL || n == NULL) {
|
if(e == NULL || n == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user