]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cifsd: fix memory leak when loop ends
authorMuhammad Usama Anjum <musamaanjum@gmail.com>
Thu, 1 Apr 2021 08:54:43 +0000 (17:54 +0900)
committerNamjae Jeon <namjae.jeon@samsung.com>
Mon, 12 Apr 2021 05:32:12 +0000 (14:32 +0900)
commit56188896a5bc35939507a2cd919484ed555cb8f1
treeb6e6f9e4c8a2cc0c0f0775282128a649f6ce4a41
parent621785af844e86170676d7fcccd15d09a0d5c823
cifsd: fix memory leak when loop ends

Memory is being allocated and if veto_list is zero, the loop breaks
without cleaning up the allocated memory. In this patch, the length
check has been moved before allocation. If loop breaks, the memory isn't
allocated in the first place. Thus the memory is being protected from
leaking.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1503590 ("Resource leaks")
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifsd/mgmt/share_config.c