1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

api: allow to add empty buffer with function infolist_new_var_buffer

This fixes the following error with `/upgrade` command when relay clients are
connected:

  relay: failed to save upgrade data
This commit is contained in:
Sébastien Helleu
2024-12-22 19:05:52 +01:00
parent c9c57eeee2
commit 42c65cebcb
2 changed files with 15 additions and 4 deletions
+1
View File
@@ -4,6 +4,7 @@
### Fixed
- api: allow to add empty buffer with function infolist_new_var_buffer
- core: fix detection of dl library ([#2218](https://github.com/weechat/weechat/issues/2218))
- logger: fix path displayed when the logs directory can not be created
- perl: fix build with Perl < 5.7.29 ([#2219](https://github.com/weechat/weechat/issues/2219), [#2220](https://github.com/weechat/weechat/issues/2220))
+14 -4
View File
@@ -247,17 +247,27 @@ infolist_new_var_buffer (struct t_infolist_item *item,
{
struct t_infolist_var *new_var;
if (!item || !name || !name[0] || (size <= 0))
if (!item || !name || !name[0])
return NULL;
if (size < 0)
size = 0;
new_var = malloc (sizeof (*new_var));
if (new_var)
{
new_var->name = strdup (name);
new_var->type = INFOLIST_BUFFER;
new_var->value = malloc (size);
if (new_var->value)
memcpy (new_var->value, pointer, size);
if (pointer && (size > 0))
{
new_var->value = malloc (size);
if (new_var->value)
memcpy (new_var->value, pointer, size);
}
else
{
new_var->value = NULL;
}
new_var->size = size;
new_var->prev_var = item->last_var;