Resource list is allocated during pass configuration is parsed. But,
nowhere is deallocation function for freeing it. To protect memory
leakage, resource will be freed properly.
Change-Id: I6125c06604e2b0c6824c258b2a4d4f6ce4a2d902
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
return 0;
}
-int pass_parse_resource(struct pass *pass, char *pass_conf_path)
+int pass_get_resource_config(struct pass *pass, char *pass_conf_path)
{
return config_parse(pass_conf_path, pass_resource_config, pass);
}
+
+void pass_put_resource_config(struct pass *pass)
+{
+ free(pass->res);
+ pass->res = NULL;
+}
int pass_get_table(struct pass_policy *policy, char *pass_conf_path);
void pass_put_table(struct pass_policy *policy);
-int pass_parse_resource(struct pass *pass, char *pass_conf_path);
+int pass_get_resource_config(struct pass *pass, char *pass_conf_path);
+void pass_put_resource_config(struct pass *pass);
#endif /* __PASS_PARSER__ */
int i, ret;
/* Parse configuration file (/etc/pass/pass.conf) */
- ret = pass_parse_resource(&g_pass, PASS_CONF_PATH);
+ ret = pass_get_resource_config(&g_pass, PASS_CONF_PATH);
if (ret < 0) {
_E("cannot parse %s\n", PASS_CONF_PATH);
return ret;
}
}
+ pass_put_resource_config(&g_pass);
+
return 0;
}