e: Fix realloc issue in e font module

Summary:
@Fix

Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>

Reviewers: zmike

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3306
This commit is contained in:
Vivek Ellur 2015-11-10 12:26:14 -05:00 committed by Mike Blumenkrantz
parent bd0c590489
commit f026fdf9b3
1 changed files with 7 additions and 1 deletions

View File

@ -159,7 +159,7 @@ _e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, con
s1 = strchr(font, ':');
if (s1)
{
char *s2, *name, *style;
char *s2, *name, *style, *temp;
int len;
len = s1 - font;
@ -171,7 +171,13 @@ _e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, con
if (s2)
{
len = s2 - name;
temp = name;
name = realloc(name, sizeof(char) * len + 1);
if (!name)
{
free(temp);
return NULL;
}
memset(name, 0, sizeof(char) * len + 1);
strncpy(name, font, len);
}