summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-01-28 22:18:14 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-01-29 12:41:19 +0100
commitfa6a9bb9341c5a834e211730bd33dad14040d3bd (patch)
tree7d118fe64986ba8e7a55834a590c29e29d1e41cb /src/plugins
parent48c1aebb83dfc3b9d507ed1398c0430982b19b41 (diff)
downloadweechat-fa6a9bb9341c5a834e211730bd33dad14040d3bd.zip
api: readjust string size in function string_dyn_free when string is not freed (issue #1875)
This frees some allocated memory if size_alloc was greater than size in the dynamic string.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/buflist/buflist-bar-item.c7
-rw-r--r--src/plugins/irc/irc-join.c5
2 files changed, 4 insertions, 8 deletions
diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c
index 1c7abf3c9..d7dcc0868 100644
--- a/src/plugins/buflist/buflist-bar-item.c
+++ b/src/plugins/buflist/buflist-bar-item.c
@@ -574,8 +574,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
-1);
}
}
- str_hotlist = *hotlist;
- weechat_string_dyn_free (hotlist, 0);
+ str_hotlist = weechat_string_dyn_free (hotlist, 0);
}
}
weechat_hashtable_set (
@@ -655,15 +654,15 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
line_number++;
}
- str_buflist = *buflist;
+ str_buflist = weechat_string_dyn_free (buflist, 0);
goto end;
error:
+ weechat_string_dyn_free (buflist, 1);
str_buflist = NULL;
end:
- weechat_string_dyn_free (buflist, 0);
weechat_arraylist_free (buffers);
if ((line_number_current_buffer != old_line_number_current_buffer[item_index])
diff --git a/src/plugins/irc/irc-join.c b/src/plugins/irc/irc-join.c
index 82f8566b2..609c2b50c 100644
--- a/src/plugins/irc/irc-join.c
+++ b/src/plugins/irc/irc-join.c
@@ -372,10 +372,7 @@ irc_join_build_string (struct t_arraylist *arraylist)
end:
if (channels)
- {
- result = *channels;
- weechat_string_dyn_free (channels, 0);
- }
+ result = weechat_string_dyn_free (channels, 0);
if (keys)
weechat_string_dyn_free (keys, 1);