Skip to content

Commit

Permalink
ecryptfs: fix a memory leak bug in ecryptfs_init_messaging()
Browse files Browse the repository at this point in the history
In ecryptfs_init_messaging(), if the allocation for 'ecryptfs_msg_ctx_arr'
fails, the previously allocated 'ecryptfs_daemon_hash' is not deallocated,
leading to a memory leak bug. To fix this issue, free
'ecryptfs_daemon_hash' before returning the error.

Cc: [email protected]
Fixes: 88b4a07 ("[PATCH] eCryptfs: Public key transport mechanism")
Signed-off-by: Wenwen Wang <[email protected]>
Signed-off-by: Tyler Hicks <[email protected]>
  • Loading branch information
wenwenwang1 authored and tyhicks committed Aug 20, 2019
1 parent fe2e082 commit b4a81b8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/ecryptfs/messaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ int __init ecryptfs_init_messaging(void)
* ecryptfs_message_buf_len),
GFP_KERNEL);
if (!ecryptfs_msg_ctx_arr) {
kfree(ecryptfs_daemon_hash);
rc = -ENOMEM;
goto out;
}
Expand Down

0 comments on commit b4a81b8

Please sign in to comment.