summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-04-18 09:21:35 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-04-18 09:21:35 +0300
commita046f3459095c8a8993713b25a15e422d3340746 (patch)
tree15e73346106fc4a5ed4d735d8a997cb57a1aaec4
parent60fb57a3e516a3781539e53148f9ff3f94f13753 (diff)
Eolian/Lexer: Fix coverity issues.
Fix CID 1203411 Fix CID 1203412
-rw-r--r--src/lib/eolian/eo_lexer.c13
-rw-r--r--src/lib/eolian/eo_lexer.rl13
-rw-r--r--src/lib/eolian/eolian_database.c18
-rw-r--r--src/lib/eolian/eolian_database.h2
4 files changed, 32 insertions, 14 deletions
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index 2a29144..739fc0f 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -4360,7 +4360,7 @@ _types_extract(const char *buf, int len)
4360 if (depth < 0) 4360 if (depth < 0)
4361 { 4361 {
4362 ERR("%s: Cannot reopen < after >", save_buf); 4362 ERR("%s: Cannot reopen < after >", save_buf);
4363 return NULL; 4363 goto error;
4364 } 4364 }
4365 depth++; 4365 depth++;
4366 end_type = EINA_TRUE; 4366 end_type = EINA_TRUE;
@@ -4371,12 +4371,12 @@ _types_extract(const char *buf, int len)
4371 if (depth == 0) 4371 if (depth == 0)
4372 { 4372 {
4373 ERR("%s: Too much >", save_buf); 4373 ERR("%s: Too much >", save_buf);
4374 return NULL; 4374 goto error;
4375 } 4375 }
4376 if (d == tmp_type) 4376 if (d == tmp_type)
4377 { 4377 {
4378 ERR("%s: empty type inside <>", save_buf); 4378 ERR("%s: empty type inside <>", save_buf);
4379 return NULL; 4379 goto error;
4380 } 4380 }
4381 if (depth > 0) depth *= -1; 4381 if (depth > 0) depth *= -1;
4382 depth++; 4382 depth++;
@@ -4400,9 +4400,14 @@ _types_extract(const char *buf, int len)
4400 } 4400 }
4401 if (depth) 4401 if (depth)
4402 { 4402 {
4403 types = NULL;
4404 ERR("%s: < and > are not well used.", save_buf); 4403 ERR("%s: < and > are not well used.", save_buf);
4404 goto error;
4405 } 4405 }
4406 goto success;
4407error:
4408 database_type_del(types);
4409 types = NULL;
4410success:
4406 free(tmp_type); 4411 free(tmp_type);
4407 return types; 4412 return types;
4408} 4413}
diff --git a/src/lib/eolian/eo_lexer.rl b/src/lib/eolian/eo_lexer.rl
index a753300..b36b460 100644
--- a/src/lib/eolian/eo_lexer.rl
+++ b/src/lib/eolian/eo_lexer.rl
@@ -1330,7 +1330,7 @@ _types_extract(const char *buf, int len)
1330 if (depth < 0) 1330 if (depth < 0)
1331 { 1331 {
1332 ERR("%s: Cannot reopen < after >", save_buf); 1332 ERR("%s: Cannot reopen < after >", save_buf);
1333 return NULL; 1333 goto error;
1334 } 1334 }
1335 depth++; 1335 depth++;
1336 end_type = EINA_TRUE; 1336 end_type = EINA_TRUE;
@@ -1341,12 +1341,12 @@ _types_extract(const char *buf, int len)
1341 if (depth == 0) 1341 if (depth == 0)
1342 { 1342 {
1343 ERR("%s: Too much >", save_buf); 1343 ERR("%s: Too much >", save_buf);
1344 return NULL; 1344 goto error;
1345 } 1345 }
1346 if (d == tmp_type) 1346 if (d == tmp_type)
1347 { 1347 {
1348 ERR("%s: empty type inside <>", save_buf); 1348 ERR("%s: empty type inside <>", save_buf);
1349 return NULL; 1349 goto error;
1350 } 1350 }
1351 if (depth > 0) depth *= -1; 1351 if (depth > 0) depth *= -1;
1352 depth++; 1352 depth++;
@@ -1370,9 +1370,14 @@ _types_extract(const char *buf, int len)
1370 } 1370 }
1371 if (depth) 1371 if (depth)
1372 { 1372 {
1373 types = NULL;
1374 ERR("%s: < and > are not well used.", save_buf); 1373 ERR("%s: < and > are not well used.", save_buf);
1374 goto error;
1375 } 1375 }
1376 goto success;
1377error:
1378 database_type_del(types);
1379 types = NULL;
1380success:
1376 free(tmp_type); 1381 free(tmp_type);
1377 return types; 1382 return types;
1378} 1383}
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 30ac8db..cb815fe 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -108,16 +108,22 @@ _param_del(_Parameter_Desc *pdesc)
108{ 108{
109 eina_stringshare_del(pdesc->name); 109 eina_stringshare_del(pdesc->name);
110 110
111 while (pdesc->type) 111 database_type_del(pdesc->type);
112 {
113 _Parameter_Type *type = (_Parameter_Type *) pdesc->type;
114 eina_stringshare_del(type->name);
115 pdesc->type = eina_inlist_remove(pdesc->type, EINA_INLIST_GET(type));
116 }
117 eina_stringshare_del(pdesc->description); 112 eina_stringshare_del(pdesc->description);
118 free(pdesc); 113 free(pdesc);
119} 114}
120 115
116void
117database_type_del(Eolian_Type type)
118{
119 while (type)
120 {
121 _Parameter_Type *ptype = (_Parameter_Type *) type;
122 eina_stringshare_del(ptype->name);
123 type = eina_inlist_remove(type, EINA_INLIST_GET(ptype));
124 }
125}
126
121static void 127static void
122_fid_del(_Function_Id *fid) 128_fid_del(_Function_Id *fid)
123{ 129{
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 106ffea..82e9a3a 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -88,6 +88,8 @@ Eolian_Function_Parameter database_method_parameter_add(Eolian_Function foo_id,
88 88
89Eolian_Type database_type_append(Eolian_Type types, const char *name, Eina_Bool own); 89Eolian_Type database_type_append(Eolian_Type types, const char *name, Eina_Bool own);
90 90
91void database_type_del(Eolian_Type type);
92
91void database_parameter_const_attribute_set(Eolian_Function_Parameter param_desc, Eina_Bool is_get, Eina_Bool is_const); 93void database_parameter_const_attribute_set(Eolian_Function_Parameter param_desc, Eina_Bool is_get, Eina_Bool is_const);
92 94
93void database_parameter_nonull_set(Eolian_Function_Parameter, Eina_Bool nonull); 95void database_parameter_nonull_set(Eolian_Function_Parameter, Eina_Bool nonull);