diff options
Diffstat (limited to 'src/plugins/relay')
-rw-r--r-- | src/plugins/relay/irc/relay-irc.c | 20 | ||||
-rw-r--r-- | src/plugins/relay/relay-info.c | 7 | ||||
-rw-r--r-- | src/plugins/relay/relay-network.c | 8 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 9 |
4 files changed, 29 insertions, 15 deletions
diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index 506afb020..e54e52403 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -1322,11 +1322,12 @@ relay_irc_recv_command_capab (struct t_relay_client *client, void relay_irc_recv (struct t_relay_client *client, const char *data) { - char str_time[128], str_signal[128], str_server_channel[256]; - char str_command[128], *target, **irc_argv, **irc_argv_eol, *pos, *password; + char str_time[128], str_signal[128], str_server_channel[256], *nick; + char *version, str_command[128], *target, **irc_argv, **irc_argv_eol; + char *pos, *password, *irc_is_channel, *info; const char *irc_command, *irc_channel, *irc_args, *irc_args2; int irc_argc, redirect_msg; - const char *nick, *irc_is_channel, *isupport, *info, *pos_password; + const char *isupport, *pos_password; struct t_hashtable *hash_parsed, *hash_redirect; struct t_infolist *infolist_server; @@ -1512,7 +1513,10 @@ relay_irc_recv (struct t_relay_client *client, const char *data) free (RELAY_IRC_DATA(client, nick)); RELAY_IRC_DATA(client, nick) = strdup (nick); } + if (nick) + free (nick); + version = weechat_info_get ("version", NULL); relay_irc_sendf (client, ":%s 001 %s :Welcome to the Internet " "Relay Chat Network %s!%s@proxy", @@ -1525,7 +1529,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data) "weechat-relay-irc, running version %s", RELAY_IRC_DATA(client, address), RELAY_IRC_DATA(client, nick), - weechat_info_get ("version", NULL)); + version); snprintf (str_time, sizeof (str_time), "%s", ctime (&client->listen_start_time)); if (str_time[0]) @@ -1540,7 +1544,9 @@ relay_irc_recv (struct t_relay_client *client, const char *data) RELAY_IRC_DATA(client, address), RELAY_IRC_DATA(client, nick), RELAY_IRC_DATA(client, address), - weechat_info_get ("version", NULL)); + version); + if (version) + free (version); infolist_server = weechat_infolist_get ("irc_server", NULL, client->protocol_args); if (infolist_server) @@ -1651,6 +1657,8 @@ relay_irc_recv (struct t_relay_client *client, const char *data) "/query %s %s", irc_channel, irc_args2); } + if (irc_is_channel) + free (irc_is_channel); } else if (!relay_irc_command_ignored (irc_command)) { @@ -1721,6 +1729,8 @@ relay_irc_recv (struct t_relay_client *client, const char *data) "mode_user"); } } + if (info) + free (info); } } else if (weechat_strcasecmp (irc_command, "ison") == 0) diff --git a/src/plugins/relay/relay-info.c b/src/plugins/relay/relay-info.c index 24b68b236..3b33d88c1 100644 --- a/src/plugins/relay/relay-info.c +++ b/src/plugins/relay/relay-info.c @@ -32,14 +32,13 @@ * Returns relay info "relay_client_count". */ -const char * +char * relay_info_info_relay_client_count_cb (const void *pointer, void *data, const char *info_name, const char *arguments) { - static char str_count[32]; + char str_count[32], **items; const char *ptr_count; - char **items; int count, protocol, status, num_items; struct t_relay_client *ptr_client; @@ -110,7 +109,7 @@ end: if (items) weechat_string_free_split (items); - return ptr_count; + return (ptr_count) ? strdup (ptr_count) : NULL; } /* diff --git a/src/plugins/relay/relay-network.c b/src/plugins/relay/relay-network.c index 5d7b94ba2..85944044f 100644 --- a/src/plugins/relay/relay-network.c +++ b/src/plugins/relay/relay-network.c @@ -52,7 +52,7 @@ void relay_network_set_ssl_cert_key (int verbose) { #ifdef HAVE_GNUTLS - char *certkey_path, *certkey_path2; + char *certkey_path, *certkey_path2, *weechat_dir; int ret; gnutls_certificate_free_credentials (relay_gnutls_x509_cred); @@ -63,9 +63,11 @@ relay_network_set_ssl_cert_key (int verbose) certkey_path = weechat_string_expand_home (weechat_config_string (relay_config_network_ssl_cert_key)); if (certkey_path) { + weechat_dir = weechat_info_get ("weechat_dir", NULL); certkey_path2 = weechat_string_replace (certkey_path, "%h", - weechat_info_get ("weechat_dir", - NULL)); + weechat_dir); + if (weechat_dir) + free (weechat_dir); if (certkey_path2) { ret = gnutls_certificate_set_x509_key_file (relay_gnutls_x509_cred, diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 26509bc38..d007d6396 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -169,8 +169,7 @@ relay_weechat_protocol_is_sync (struct t_relay_client *ptr_client, RELAY_WEECHAT_PROTOCOL_CALLBACK(init) { - char **options, *pos, *password, *totp_secret, *info_totp_args; - const char *info_totp; + char **options, *pos, *password, *totp_secret, *info_totp_args, *info_totp; int i, compression, length; RELAY_WEECHAT_PROTOCOL_MIN_ARGS(1); @@ -217,6 +216,8 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(init) info_totp = weechat_info_get ("totp_validate", info_totp_args); if (info_totp && (strcmp (info_totp, "1") == 0)) RELAY_WEECHAT_DATA(client, totp_ok) = 1; + if (info_totp) + free (info_totp); free (info_totp_args); } free (totp_secret); @@ -290,7 +291,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(hdata) RELAY_WEECHAT_PROTOCOL_CALLBACK(info) { struct t_relay_weechat_msg *msg; - const char *info; + char *info; RELAY_WEECHAT_PROTOCOL_MIN_ARGS(1); @@ -304,6 +305,8 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(info) relay_weechat_msg_add_string (msg, info); relay_weechat_msg_send (client, msg); relay_weechat_msg_free (msg); + if (info) + free (info); } return WEECHAT_RC_OK; |