1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 22:36:38 +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
+12 -1
View File
@@ -59,6 +59,7 @@ void
gui_input_optimize_size (struct t_gui_buffer *buffer)
{
int optimal_size;
char *input_buffer2;
if (buffer->input)
{
@@ -67,7 +68,17 @@ gui_input_optimize_size (struct t_gui_buffer *buffer)
if (buffer->input_buffer_alloc != optimal_size)
{
buffer->input_buffer_alloc = optimal_size;
buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
input_buffer2 = realloc (buffer->input_buffer, optimal_size);
if (!input_buffer2)
{
if (buffer->input_buffer)
{
free (buffer->input_buffer);
buffer->input_buffer = NULL;
}
return;
}
buffer->input_buffer = input_buffer2;
}
}
}