summaryrefslogtreecommitdiff
path: root/src/gui/gui-buffer.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2016-08-13 14:51:09 +0200
committerSébastien Helleu <flashcode@flashtux.org>2016-08-13 14:51:09 +0200
commit7447b81f87152c24c2ccfbdd7cf1c3acb233a8ec (patch)
tree5b4d89e95b2d31799715384d295c195a27a4f82b /src/gui/gui-buffer.c
parent3e35df9bcefb94a2cab4c7625786f91927a6baef (diff)
downloadweechat-7447b81f87152c24c2ccfbdd7cf1c3acb233a8ec.zip
core: fix NULL pointer derefence in case of memory error in gui_buffer_input_buffer_init()
Diffstat (limited to 'src/gui/gui-buffer.c')
-rw-r--r--src/gui/gui-buffer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 5a0d0c861..d85f06aff 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -537,7 +537,8 @@ gui_buffer_input_buffer_init (struct t_gui_buffer *buffer)
{
buffer->input_buffer_alloc = GUI_BUFFER_INPUT_BLOCK_SIZE;
buffer->input_buffer = malloc (GUI_BUFFER_INPUT_BLOCK_SIZE);
- buffer->input_buffer[0] = '\0';
+ if (buffer->input_buffer)
+ buffer->input_buffer[0] = '\0';
buffer->input_buffer_size = 0;
buffer->input_buffer_length = 0;
buffer->input_buffer_pos = 0;