X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconfig%2Fsession-config.cpp;h=de0b519f7b7e614cdb82ed6a1d73396148f9705b;hb=f149493493fbd8a3efa4748832c03278c96c38ca;hp=dfbddf2913d25550c7058ca96b9d7e54757501e9;hpb=c9e313bc594f40a86eed237dce222c0fc99c957f;p=lttng-tools.git diff --git a/src/common/config/session-config.cpp b/src/common/config/session-config.cpp index dfbddf291..de0b519f7 100644 --- a/src/common/config/session-config.cpp +++ b/src/common/config/session-config.cpp @@ -39,11 +39,13 @@ #define CONFIG_USERSPACE_PROBE_LOOKUP_METHOD_NAME_MAX_LEN 7 +namespace { struct session_config_validation_ctx { xmlSchemaParserCtxtPtr parser_ctx; xmlSchemaPtr schema; xmlSchemaValidCtxtPtr schema_validation_ctx; }; +} /* namespace */ const char * const config_element_all = "all"; LTTNG_EXPORT const char *config_xml_encoding = "UTF-8"; @@ -233,12 +235,14 @@ enum process_event_node_phase { ENABLE = 1, }; +namespace { struct consumer_output { int enabled; char *path; char *control_uri; char *data_uri; }; +} /* namespace */ /* * Returns a xmlChar string which must be released using xmlFree(). @@ -287,7 +291,7 @@ struct config_writer *config_writer_create(int fd_output, int indent) struct config_writer *writer; xmlOutputBufferPtr buffer; - writer = (config_writer *) zmalloc(sizeof(struct config_writer)); + writer = zmalloc(); if (!writer) { PERROR("zmalloc config_writer_create"); goto end; @@ -581,7 +585,7 @@ char *get_session_config_xsd_path(void) base_path_len = strlen(base_path); max_path_len = base_path_len + sizeof(DEFAULT_SESSION_CONFIG_XSD_FILENAME) + 1; - xsd_path = (char *) zmalloc(max_path_len); + xsd_path = zmalloc(max_path_len); if (!xsd_path) { goto end; } @@ -1856,7 +1860,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle, continue; } - exclusions = (char **) zmalloc(exclusion_count * sizeof(char *)); + exclusions = calloc(exclusion_count); if (!exclusions) { exclusion_count = 0; ret = -LTTNG_ERR_NOMEM; @@ -3399,9 +3403,8 @@ int process_session_node(xmlNodePtr session_node, const char *session_name, /* Init domains to create the session handles */ for (node = xmlFirstElementChild(domains_node); node; node = xmlNextElementSibling(node)) { - struct lttng_domain *domain; + lttng_domain *domain = zmalloc(); - domain = (lttng_domain *) zmalloc(sizeof(*domain)); if (!domain) { ret = -LTTNG_ERR_NOMEM; goto error;