From 10bf2a866593b0e5eea0838a9772c79d507d36f4 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 2 Jan 2011 13:09:02 +0100 Subject: Test if variables are not NULL before free in function hook_print_exec --- src/core/wee-hook.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 6bce94883..67478bd6d 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -1804,7 +1804,8 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line) message_no_color = gui_color_decode (line->data->message, NULL); if (!message_no_color) { - free (prefix_no_color); + if (prefix_no_color) + free (prefix_no_color); return; } @@ -1876,8 +1877,10 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line) ptr_hook = next_hook; } - free (prefix_no_color); - free (message_no_color); + if (prefix_no_color) + free (prefix_no_color); + if (message_no_color) + free (message_no_color); hook_exec_end (); } -- cgit v1.2.3