mount.cifs.c: fix memory leaks in main func
authorJiawen Liu <liujiawen10@huawei.com>
Tue, 6 Aug 2019 02:35:29 +0000 (10:35 +0800)
committerPavel Shilovsky <pshilov@microsoft.com>
Wed, 7 Aug 2019 21:38:02 +0000 (14:38 -0700)
commitbf7f48f4c7dcee623bd92b2e7a6ffd97a64a1138
treee9beb8a2c2ac9f57564db51c1b01df128c0eaca9
parent13c370424575d864544bfb4535832dfcffa91e82
mount.cifs.c: fix memory leaks in main func

In mount.cifs module, orgoptions and mountpoint in the main func
point to the memory allocated by func realpath and strndup respectively.
However, they are not freed before the main func returns so that the
memory leaks occurred.

The memory leak problem is reported by LeakSanitizer tool.
LeakSanitizer url: "https://github.com/google/sanitizers"

Here I free the pointers orgoptions and mountpoint before main
func returns.

Fixes:7549ad5e7126 ("memory leaks: caused by func realpath and strndup")
Signed-off-by: Jiawen Liu <liujiawen10@huawei.com>
Reported-by: Jin Du <dujin1@huawei.com>
Reviewed-by: Saisai Zhang <zhangsaisai@huawei.com>
Reviewed-by: Aurélien Aptel <aaptel@suse.com>
mount.cifs.c