1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 12:56:37 +02:00

core: fix bugs with calls to realloc

This commit is contained in:
Sebastien Helleu
2011-08-28 15:25:30 +02:00
parent e411d14b7a
commit f843f904bc
16 changed files with 259 additions and 106 deletions
+10 -5
View File
@@ -817,7 +817,8 @@ void
script_action_add (char **action_list, const char *name)
{
int length;
char *action_list2;
length = strlen (name);
if (!(*action_list))
@@ -828,13 +829,17 @@ script_action_add (char **action_list, const char *name)
}
else
{
*action_list = realloc (*action_list,
action_list2 = realloc (*action_list,
strlen (*action_list) + 1 + length + 1);
if (*action_list)
if (!action_list2)
{
strcat (*action_list, ",");
strcat (*action_list, name);
free (*action_list);
*action_list = NULL;
return;
}
*action_list = action_list2;
strcat (*action_list, ",");
strcat (*action_list, name);
}
}