Skip to content

Commit a4c0119

Browse files
huanghuihui0904chrisbra
authored andcommitted
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>
1 parent 742e872 commit a4c0119

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/fileio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,8 +3074,12 @@ check_for_cryptkey(
30743074

30753075
header_len = crypt_get_header_len(method);
30763076
if (*sizep < header_len)
3077+
{
30773078
// invalid header, buffer can't be encrypted
3079+
if (cryptkey != curbuf->b_p_key)
3080+
vim_free(cryptkey);
30783081
return NULL;
3082+
}
30793083

30803084
curbuf->b_cryptstate = crypt_create_from_header(
30813085
method, cryptkey, ptr);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
242,
737739
/**/
738740
241,
739741
/**/

0 commit comments

Comments
 (0)