]> 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)
committerSteve French <stfrench@microsoft.com>
Mon, 19 Apr 2021 00:20:51 +0000 (19:20 -0500)
commit45ac1be7c8b5d83643944edc945f108b14368582
treeecb3ce074a1c7d65fd753d88c358e2aad2904079
parent6760778ea9cd9406af89061a73193a16e3723c25
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