mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.2.0242: memory leak in check_for_cryptkey()
Problem: memory leak in check_for_cryptkey()
Solution: Free cryptkey if it had been allocated
(Huihui Huang)
closes: #19821
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
742e8722b3
commit
a4c0119786
@@ -3074,8 +3074,12 @@ check_for_cryptkey(
|
||||
|
||||
header_len = crypt_get_header_len(method);
|
||||
if (*sizep < header_len)
|
||||
{
|
||||
// invalid header, buffer can't be encrypted
|
||||
if (cryptkey != curbuf->b_p_key)
|
||||
vim_free(cryptkey);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
curbuf->b_cryptstate = crypt_create_from_header(
|
||||
method, cryptkey, ptr);
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
242,
|
||||
/**/
|
||||
241,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user