2019-05-08 13:47:51

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 14/19] Removed a resource leak from mount/configfile.c

mount/configfile.c:410: leaked_storage: Variable "config_opts"
going out of scope leaks the storage it points to.

Signed-off-by: Steve Dickson <[email protected]>
---
utils/mount/configfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index b48b25e..93fe500 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -404,7 +404,7 @@ char *conf_get_mntopts(char *spec, char *mount_point,

/* list_size + optlen + ',' + '\0' */
config_opts = calloc(1, (list_size+optlen+2));
- if (server == NULL) {
+ if (config_opts == NULL) {
xlog_warn("conf_get_mountops: Unable calloc memory for config_opts");
free_all();
return mount_opts;
--
2.20.1