summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pki_container_openssh.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/pki_container_openssh.c b/src/pki_container_openssh.c
index c276f486..bfc6f8d4 100644
--- a/src/pki_container_openssh.c
+++ b/src/pki_container_openssh.c
@@ -613,9 +613,16 @@ ssh_string ssh_pki_openssh_privkey_export(const ssh_key privkey,
}
if (to_encrypt){
- ssh_buffer kdf_buf = ssh_buffer_new();
+ ssh_buffer kdf_buf;
+
+ kdf_buf = ssh_buffer_new();
+ if (kdf_buf == NULL) {
+ goto error;
+ }
+
salt = ssh_string_new(16);
- if (kdf_buf == NULL || salt == NULL){
+ if (salt == NULL){
+ ssh_buffer_free(kdf_buf);
goto error;
}
ssh_get_random(ssh_string_data(salt),16, 0);