express: Fix possible double-free of Row_Color (Fixes T2404)

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-05-11 10:01:42 -04:00
parent c483e14ad0
commit e0499cee00
2 changed files with 6 additions and 8 deletions

View File

@ -997,19 +997,21 @@ _channel_text_append(Channel *chl, const char *user, const char *txt, Row_Color
{
/* If user is * ie for messages use a different color */
int user_color = 31;
Row_Color *ucolor;
if (strncmp(user, "*", strlen(user)) == 0)
{
user_color = 78;
}
_grid_text_append(chl->o_grid, user, strlen(user),
_row_color_simple_create(user_color));
_grid_text_append(chl->o_grid, "\t", strlen("\t"),
_row_color_simple_create(user_color));
ucolor = _row_color_simple_create(user_color);
_grid_text_append(chl->o_grid, user, strlen(user), ucolor);
_grid_text_append(chl->o_grid, "\t", strlen("\t"), ucolor);
if (ucolor) free(ucolor);
}
_grid_text_append(chl->o_grid, txt, strlen(txt), color);
if (color) free(color);
if (!chl->active) chl->missed = EINA_TRUE;
else chl->missed = EINA_FALSE;

View File

@ -1985,14 +1985,10 @@ _text_append(Grid *sd, const Eina_Unicode *codepoints, int len, Row_Color *color
if (sd->state.cx > (sd->w - offset))
{
sd->state.cx = sd->w - offset;
if (color)
free(color);
return;
}
}
}
if (color)
free(color);
}
static int