summaryrefslogtreecommitdiff
path: root/lib/gnutls_auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gnutls_auth.c')
-rw-r--r--lib/gnutls_auth.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/gnutls_auth.c b/lib/gnutls_auth.c
index 1a345faa21..9ed24c4e3c 100644
--- a/lib/gnutls_auth.c
+++ b/lib/gnutls_auth.c
@@ -36,7 +36,6 @@ int gnutls_clear_creds( GNUTLS_STATE state) {
ccred = state->gnutls_key->cred;
while(ccred!=NULL) {
ncred = ccred->next;
- if (ccred->credentials!=NULL) gnutls_free(ccred->credentials);
if (ccred!=NULL) gnutls_free(ccred);
ccred = ncred;
}
@@ -50,7 +49,7 @@ int gnutls_clear_creds( GNUTLS_STATE state) {
* This creates a linked list of the form:
* { algorithm, credentials, pointer to next }
*/
-int gnutls_set_kx_cred( GNUTLS_STATE state, int kx, void* cred, int cred_size) {
+int gnutls_set_kx_cred( GNUTLS_STATE state, int kx, void* cred) {
AUTH_CRED * ccred, *pcred;
int exists=0;
@@ -60,8 +59,7 @@ int gnutls_set_kx_cred( GNUTLS_STATE state, int kx, void* cred, int cred_size) {
if (state->gnutls_key->cred == NULL) return GNUTLS_E_MEMORY_ERROR;
/* copy credentials localy */
- state->gnutls_key->cred->credentials = gnutls_malloc(cred_size);
- memcpy( state->gnutls_key->cred->credentials, cred, cred_size);
+ state->gnutls_key->cred->credentials = cred;
state->gnutls_key->cred->next = NULL;
state->gnutls_key->cred->algorithm = kx;
@@ -83,15 +81,13 @@ int gnutls_set_kx_cred( GNUTLS_STATE state, int kx, void* cred, int cred_size) {
ccred = pcred->next;
/* copy credentials localy */
- ccred->credentials = gnutls_malloc(cred_size);
- memcpy( ccred->credentials, cred, cred_size);
+ ccred->credentials = cred;
ccred->next = NULL;
ccred->algorithm = kx;
} else { /* modify existing entry */
gnutls_free(ccred->credentials);
- ccred->credentials = gnutls_malloc(cred_size);
- memcpy( ccred->credentials, cred, cred_size);
+ ccred->credentials = cred;
}
}