Skip to content

Commit bb79179

Browse files
dyuagentzh
authored andcommitted
bugfix: fixed one potential memory leak in an error condition.
Signed-off-by: Yichun Zhang (agentzh) <[email protected]>
1 parent 6d9db2d commit bb79179

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ngx_http_encrypted_session_cipher.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ ngx_http_encrypted_session_aes_mac_encrypt(ngx_pool_t *pool, ngx_log_t *log,
9898
p += len;
9999

100100
ret = EVP_EncryptFinal(&ctx, p, &len);
101-
if (!ret) {
102-
return NGX_ERROR;
103-
}
104101

105102
/* XXX we should still explicitly release the ctx
106103
* or we'll leak memory here */
107104
EVP_CIPHER_CTX_cleanup(&ctx);
108105

106+
if (!ret) {
107+
return NGX_ERROR;
108+
}
109+
109110
p += len;
110111

111112
*dst_len = p - *dst;

0 commit comments

Comments
 (0)