diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-04-12 21:29:39 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-04-13 08:42:45 +0200 |
commit | 3d95217745cd269e6911a0830f7e6cc515828f07 (patch) | |
tree | 7cc372d8874c2d994c444199360c040778c3e153 /src/plugins/xfer | |
parent | c80dc2a5ca93045ed7c358a8860532aab72f0c89 (diff) | |
download | weechat-3d95217745cd269e6911a0830f7e6cc515828f07.zip |
api: return allocated string in hook_info callback and function info_get
Diffstat (limited to 'src/plugins/xfer')
-rw-r--r-- | src/plugins/xfer/xfer-file.c | 7 | ||||
-rw-r--r-- | src/plugins/xfer/xfer.c | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/xfer/xfer-file.c b/src/plugins/xfer/xfer-file.c index 8ab713842..ebed633f9 100644 --- a/src/plugins/xfer/xfer-file.c +++ b/src/plugins/xfer/xfer-file.c @@ -80,8 +80,7 @@ xfer_file_resume (struct t_xfer *xfer, const char *filename) void xfer_file_find_filename (struct t_xfer *xfer) { - const char *dir_separator; - char *path, *filename2; + char *dir_separator, *path, *filename2; int length; if (!XFER_IS_FILE(xfer->type)) @@ -106,7 +105,11 @@ xfer_file_find_filename (struct t_xfer *xfer) dir_separator = weechat_info_get ("dir_separator", ""); if (dir_separator && (xfer->local_filename[strlen (xfer->local_filename) - 1] != dir_separator[0])) + { strcat (xfer->local_filename, dir_separator); + } + if (dir_separator) + free (dir_separator); if (weechat_config_boolean (xfer_config_file_use_nick_in_filename)) { strcat (xfer->local_filename, xfer->remote_nick); diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index c186998fa..00b0a7a26 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -644,8 +644,8 @@ xfer_new (const char *plugin_name, const char *plugin_id, const char *local_filename) { struct t_xfer *new_xfer; - const char *ptr_color, *ptr_crc32; - char str_address[NI_MAXHOST]; + const char *ptr_crc32; + char str_address[NI_MAXHOST], *color; int rc; new_xfer = xfer_alloc (); @@ -669,8 +669,10 @@ xfer_new (const char *plugin_name, const char *plugin_id, new_xfer->type = type; new_xfer->protocol = protocol; new_xfer->remote_nick = strdup (remote_nick); - ptr_color = weechat_info_get ("irc_nick_color_name", remote_nick); - new_xfer->remote_nick_color = (ptr_color) ? strdup (ptr_color) : NULL; + color = weechat_info_get ("irc_nick_color_name", remote_nick); + new_xfer->remote_nick_color = (color) ? strdup (color) : NULL; + if (color) + free (color); new_xfer->local_nick = (local_nick) ? strdup (local_nick) : NULL; new_xfer->charset_modifier = (charset_modifier) ? strdup (charset_modifier) : NULL; if (XFER_IS_FILE(type)) |