Browse Source

neercs: fix two potential crashes, one caused by mismatched delete/delete[]

and one caused by a bug in the current version of libcaca.
master
Sam Hocevar 12 years ago
parent
commit
0706f32aa5
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      neercs/term/pty.cpp
  2. +3
    -1
      neercs/video/render.cpp

+ 1
- 1
neercs/term/pty.cpp View File

@@ -53,7 +53,7 @@ Pty::Pty()
Pty::~Pty()
{
#if defined HAVE_PTY_H || defined HAVE_UTIL_H || defined HAVE_LIBUTIL_H
delete m_unread_data;
delete[] m_unread_data;

if (m_fd >= 0)
{


+ 3
- 1
neercs/video/render.cpp View File

@@ -864,7 +864,9 @@ void Render::TickDraw(float seconds)
int bar_x = bar_w * setup_var[setup_item_key].x;
if ((setup_var[setup_item_key].y - setup_var[setup_item_key].x) / setup_var[setup_item_key].z > 1)
{
caca_printf(m_caca, setup_p.x + setup_size.x - 4, y, "%4.2f", setup_var[setup_item_key].w);
/* Work around a bug in libcaca */
if (setup_p.x + setup_size.x - 4 < caca_get_canvas_width(m_caca))
caca_printf(m_caca, setup_p.x + setup_size.x - 4, y, "%4.2f", setup_var[setup_item_key].w);
caca_draw_line(m_caca, x, y, x - bar_x + bar_w * setup_var[setup_item_key].y, y,'.');
if (setup_var[setup_item_key].w != setup_var[setup_item_key].x) caca_draw_line(m_caca, x, y, x - bar_x + bar_w * setup_var[setup_item_key].w, y,'x');
}


Loading…
Cancel
Save