summaryrefslogtreecommitdiff
path: root/src/lib/eet
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-11-18 11:32:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-11-18 11:48:44 +0900
commitb54fe3fe617710832b0d7bfe361f3bcb3bfd0ad3 (patch)
treee510fd77d2ca4494712cde538144f43a6891ca5b /src/lib/eet
parentc4189109481b482b72864f438f5f245cfbd790ca (diff)
Edje data: Fix memory leak in nested data descriptors
Diffstat (limited to 'src/lib/eet')
-rw-r--r--src/lib/eet/eet_data.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/eet/eet_data.c b/src/lib/eet/eet_data.c
index a0c5864d3a..ad2fe47090 100644
--- a/src/lib/eet/eet_data.c
+++ b/src/lib/eet/eet_data.c
@@ -191,6 +191,7 @@ struct _Eet_Data_Element
191 int counter_offset; /* for a variable array we need the offset of the count variable */ 191 int counter_offset; /* for a variable array we need the offset of the count variable */
192 unsigned char type; /* EET_T_XXX */ 192 unsigned char type; /* EET_T_XXX */
193 unsigned char group_type; /* EET_G_XXX */ 193 unsigned char group_type; /* EET_G_XXX */
194 Eina_Bool subtype_free : 1;
194}; 195};
195 196
196struct _Eet_Data_Encode_Hash_Info 197struct _Eet_Data_Encode_Hash_Info
@@ -2108,7 +2109,15 @@ eet_data_descriptor_free(Eet_Data_Descriptor *edd)
2108 2109
2109 _eet_descriptor_hash_free(edd); 2110 _eet_descriptor_hash_free(edd);
2110 if (edd->elements.set) 2111 if (edd->elements.set)
2111 free(edd->elements.set); 2112 {
2113 int i;
2114 for (i = 0; i < edd->elements.num; i++)
2115 {
2116 if (edd->elements.set[i].subtype_free)
2117 eet_data_descriptor_free(edd->elements.set[i].subtype);
2118 }
2119 free(edd->elements.set);
2120 }
2112 2121
2113 free(edd); 2122 free(edd);
2114} 2123}
@@ -2200,6 +2209,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
2200 ede = &(edd->elements.set[edd->elements.num - 1]); 2209 ede = &(edd->elements.set[edd->elements.num - 1]);
2201 ede->name = name; 2210 ede->name = name;
2202 ede->directory_name_ptr = NULL; 2211 ede->directory_name_ptr = NULL;
2212 ede->subtype_free = EINA_FALSE;
2203 2213
2204 /* 2214 /*
2205 * We do a special case when we do list,hash or whatever group of simple type. 2215 * We do a special case when we do list,hash or whatever group of simple type.
@@ -2229,6 +2239,7 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
2229 /* 0, */ NULL, 2239 /* 0, */ NULL,
2230 NULL); 2240 NULL);
2231 type = EET_T_UNKNOW; 2241 type = EET_T_UNKNOW;
2242 ede->subtype_free = EINA_TRUE;
2232 } 2243 }
2233 2244
2234 ede->type = type; 2245 ede->type = type;