Skip to content
Permalink
Browse files

Fix memory leak in SASL

Patch by: michaelortmann
  • Loading branch information...
michaelortmann authored and vanosg committed Aug 6, 2019
1 parent 1ba6faf commit 4db5490816b80ff04b4c3e95b258655e09861b7a
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/mod/server.mod/servmsg.c
@@ -1161,6 +1161,7 @@ static int tryauthenticate(char *from, char *msg)
FILE *fp;
EC_KEY *eckey;
EVP_PKEY *privateKey;
int ret;
#endif

putlog(LOG_SERV, "*", "SASL: got AUTHENTICATE %s", msg);
@@ -1220,13 +1221,16 @@ static int tryauthenticate(char *from, char *msg)
}
fclose(fp);
eckey = EVP_PKEY_get1_EC_KEY(privateKey);
EVP_PKEY_free(privateKey);
if (!eckey) {
putlog(LOG_SERV, "*", "SASL: AUTHENTICATE: EVP_PKEY_get1_EC_KEY(): SSL error = %s\n",
ERR_error_string(ERR_get_error(), 0));
return 1;
}
dst2 = nmalloc(ECDSA_size(eckey));
if (ECDSA_sign(0, dst, olen, dst2, &olen2, eckey) == 0) {
ret = ECDSA_sign(0, dst, olen, dst2, &olen2, eckey);
EC_KEY_free(eckey);
if (!ret) {
printf("SASL: AUTHENTICATE: ECDSA_sign() SSL error = %s\n",
ERR_error_string(ERR_get_error(), 0));
nfree(dst2);

0 comments on commit 4db5490

Please sign in to comment.
You can’t perform that action at this time.