summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/src/ssl/kssl.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/libssl/src/ssl/kssl.c b/src/lib/libssl/src/ssl/kssl.c
index b4ddab7597..9e71eed9fa 100644
--- a/src/lib/libssl/src/ssl/kssl.c
+++ b/src/lib/libssl/src/ssl/kssl.c
@@ -898,8 +898,8 @@ kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which, krb5_data *realm,
898 return KSSL_CTX_ERR; 898 return KSSL_CTX_ERR;
899 break; 899 break;
900 } 900 }
901 if (*princ) 901 free(*princ);
902 free(*princ); 902 *princ = NULL;
903 903
904 /* Add up all the entity->lengths */ 904 /* Add up all the entity->lengths */
905 length = 0; 905 length = 0;
@@ -960,18 +960,11 @@ kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text)
960 return KSSL_CTX_ERR; 960 return KSSL_CTX_ERR;
961 break; 961 break;
962 } 962 }
963 if (*string) 963 free(*string);
964 free(*string); 964 *string = NULL;
965 965
966 if (!text) { 966 if ((*string = strdup(text ? text : "")) == NULL)
967 *string = '\0';
968 return KSSL_CTX_OK;
969 }
970
971 if ((*string = calloc(1, strlen(text) + 1)) == NULL)
972 return KSSL_CTX_ERR; 967 return KSSL_CTX_ERR;
973 else
974 memcpy(*string, text, strlen(text) + 1);
975 968
976 return KSSL_CTX_OK; 969 return KSSL_CTX_OK;
977} 970}
@@ -993,6 +986,7 @@ kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session)
993 if (kssl_ctx->key) { 986 if (kssl_ctx->key) {
994 OPENSSL_cleanse(kssl_ctx->key, kssl_ctx->length); 987 OPENSSL_cleanse(kssl_ctx->key, kssl_ctx->length);
995 free(kssl_ctx->key); 988 free(kssl_ctx->key);
989 kssl_ctx->key = NULL;
996 } 990 }
997 991
998 if (session) { 992 if (session) {