Skip to content

Commit

Permalink
Fix memory leak in SASL
Browse files Browse the repository at this point in the history
Patch by: michaelortmann
  • Loading branch information
michaelortmann authored and vanosg committed Aug 6, 2019
1 parent 1ba6faf commit 4db5490
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mod/server.mod/servmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4db5490

Please sign in to comment.