Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sss/src/keystore/keystore_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ sss_status_t ks_openssl_store_key(const sss_openssl_object_t *sss_key)
goto exit;
}
//Buffer = (unsigned char *)malloc(len + 1);
//OpenSSL will do the buffer allocation
len = i2d_PrivateKey(pk, &Buffer);
if (len < 0) {
goto exit;
Expand All @@ -227,6 +228,7 @@ sss_status_t ks_openssl_store_key(const sss_openssl_object_t *sss_key)
}

//Buffer = (unsigned char *)malloc(len + 1);
//OpenSSL will do the buffer allocation
len = i2d_PublicKey(pk, &Buffer);
if (len < 0) {
goto exit;
Expand All @@ -253,7 +255,11 @@ sss_status_t ks_openssl_store_key(const sss_openssl_object_t *sss_key)
}
}
if (Buffer != NULL) {
SSS_FREE(Buffer);
//SSS_FREE(Buffer);
//OpenSSL has to deallocate the buffer
//TODO: please check for same cases, where OpenSSL allocates, but SSS deallocates.
//It causes crash in case when OpenSSL uses other allocator than SSS.
OPENSSL_free(Buffer);
}
return retval;
}
Expand Down