Eolian/Lexer: Fix coverity issues.

Fix CID 1203411
Fix CID 1203412
This commit is contained in:
Daniel Zaoui 2014-04-18 09:21:35 +03:00
parent 60fb57a3e5
commit a046f34590
4 changed files with 32 additions and 14 deletions

View File

@ -4360,7 +4360,7 @@ _types_extract(const char *buf, int len)
if (depth < 0)
{
ERR("%s: Cannot reopen < after >", save_buf);
return NULL;
goto error;
}
depth++;
end_type = EINA_TRUE;
@ -4371,12 +4371,12 @@ _types_extract(const char *buf, int len)
if (depth == 0)
{
ERR("%s: Too much >", save_buf);
return NULL;
goto error;
}
if (d == tmp_type)
{
ERR("%s: empty type inside <>", save_buf);
return NULL;
goto error;
}
if (depth > 0) depth *= -1;
depth++;
@ -4400,9 +4400,14 @@ _types_extract(const char *buf, int len)
}
if (depth)
{
types = NULL;
ERR("%s: < and > are not well used.", save_buf);
goto error;
}
goto success;
error:
database_type_del(types);
types = NULL;
success:
free(tmp_type);
return types;
}

View File

@ -1330,7 +1330,7 @@ _types_extract(const char *buf, int len)
if (depth < 0)
{
ERR("%s: Cannot reopen < after >", save_buf);
return NULL;
goto error;
}
depth++;
end_type = EINA_TRUE;
@ -1341,12 +1341,12 @@ _types_extract(const char *buf, int len)
if (depth == 0)
{
ERR("%s: Too much >", save_buf);
return NULL;
goto error;
}
if (d == tmp_type)
{
ERR("%s: empty type inside <>", save_buf);
return NULL;
goto error;
}
if (depth > 0) depth *= -1;
depth++;
@ -1370,9 +1370,14 @@ _types_extract(const char *buf, int len)
}
if (depth)
{
types = NULL;
ERR("%s: < and > are not well used.", save_buf);
goto error;
}
goto success;
error:
database_type_del(types);
types = NULL;
success:
free(tmp_type);
return types;
}

View File

@ -108,16 +108,22 @@ _param_del(_Parameter_Desc *pdesc)
{
eina_stringshare_del(pdesc->name);
while (pdesc->type)
{
_Parameter_Type *type = (_Parameter_Type *) pdesc->type;
eina_stringshare_del(type->name);
pdesc->type = eina_inlist_remove(pdesc->type, EINA_INLIST_GET(type));
}
database_type_del(pdesc->type);
eina_stringshare_del(pdesc->description);
free(pdesc);
}
void
database_type_del(Eolian_Type type)
{
while (type)
{
_Parameter_Type *ptype = (_Parameter_Type *) type;
eina_stringshare_del(ptype->name);
type = eina_inlist_remove(type, EINA_INLIST_GET(ptype));
}
}
static void
_fid_del(_Function_Id *fid)
{

View File

@ -88,6 +88,8 @@ Eolian_Function_Parameter database_method_parameter_add(Eolian_Function foo_id,
Eolian_Type database_type_append(Eolian_Type types, const char *name, Eina_Bool own);
void database_type_del(Eolian_Type type);
void database_parameter_const_attribute_set(Eolian_Function_Parameter param_desc, Eina_Bool is_get, Eina_Bool is_const);
void database_parameter_nonull_set(Eolian_Function_Parameter, Eina_Bool nonull);