Skip to content

Commit b4a81b8

Browse files
wenwenwang1tyhicks
authored andcommitted
ecryptfs: fix a memory leak bug in ecryptfs_init_messaging()
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]>
1 parent fe2e082 commit b4a81b8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/ecryptfs/messaging.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ int __init ecryptfs_init_messaging(void)
379379
* ecryptfs_message_buf_len),
380380
GFP_KERNEL);
381381
if (!ecryptfs_msg_ctx_arr) {
382+
kfree(ecryptfs_daemon_hash);
382383
rc = -ENOMEM;
383384
goto out;
384385
}

0 commit comments

Comments
 (0)