crm_send_remote_msg(void *session, xmlNode * msg, gboolean encrypted)
{
    int rc = -1;
    char *xml_text = NULL;
    int len = 0;

    xml_text = dump_xml_unformatted(msg);
    if (xml_text) {
        len = strlen(xml_text);
    } else {
        crm_err("Invalid XML, can not send msg");
        return -1;
    }

    rc = crm_send_remote_msg_raw(session, xml_text, len, encrypted);
    if (rc < 0) {
        goto done;
    }
    rc = crm_send_remote_msg_raw(session, REMOTE_MSG_TERMINATOR, strlen(REMOTE_MSG_TERMINATOR), encrypted);

done:
    if (rc < 0) {
        crm_err("Failed to send remote msg, rc = %d", rc);
    }

    free(xml_text);
    return rc;
}
Weaknesses in this category are related to improper management of system resources.