summaryrefslogtreecommitdiff
path: root/src/lib/eet/eet_data.c
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman.samsung@gmail.com>2018-11-13 14:30:09 -0600
committerDerek Foreman <derek.foreman.samsung@gmail.com>2018-11-16 12:16:07 -0600
commit1e498286d999109eb4504e4cf98b1412d4554f0b (patch)
tree7cfd0a2dab7fc934f9c13ce38c9c0302832e02e5 /src/lib/eet/eet_data.c
parent5889307f4cae1a1ff04eba1631853b605283aaf8 (diff)
eet: Stop freeing allocated memory in descriptor_decode
There are other paths that free this memory, so it ends up freed by the EET_G_UNKNOWN_NESTED path, yet remains on the list. It makes more sense to have all the callers deal with this memory. Differential Revision: https://phab.enlightenment.org/D7280 Signed-off-by: Derek Foreman <derek.foreman.samsung@gmail.com>
Diffstat (limited to '')
-rw-r--r--src/lib/eet/eet_data.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/lib/eet/eet_data.c b/src/lib/eet/eet_data.c
index cf3e72d3cb..c3ad0a0989 100644
--- a/src/lib/eet/eet_data.c
+++ b/src/lib/eet/eet_data.c
@@ -3568,6 +3568,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
3568 char *p; 3568 char *p;
3569 int size, i; 3569 int size, i;
3570 Eet_Data_Chunk chnk; 3570 Eet_Data_Chunk chnk;
3571 Eina_Bool need_free = EINA_FALSE;
3571 3572
3572 if (_eet_data_words_bigendian == -1) 3573 if (_eet_data_words_bigendian == -1)
3573 { 3574 {
@@ -3590,6 +3591,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
3590 else 3591 else
3591 { 3592 {
3592 data = edd->func.mem_alloc(edd->size); 3593 data = edd->func.mem_alloc(edd->size);
3594 need_free = EINA_TRUE;
3593 } 3595 }
3594 3596
3595 if (!data) 3597 if (!data)
@@ -3604,8 +3606,6 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
3604 } 3606 }
3605 3607
3606 _eet_freelist_all_ref(context); 3608 _eet_freelist_all_ref(context);
3607 if (data && !data_out)
3608 _eet_freelist_add(context, data);
3609 3609
3610 memset(&chnk, 0, sizeof(Eet_Data_Chunk)); 3610 memset(&chnk, 0, sizeof(Eet_Data_Chunk));
3611 eet_data_chunk_get(ed, &chnk, data_in, size_in); 3611 eet_data_chunk_get(ed, &chnk, data_in, size_in);
@@ -3775,6 +3775,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
3775 return data; 3775 return data;
3776 3776
3777error: 3777error:
3778 if (need_free) free(data);
3778 eet_node_del(result); 3779 eet_node_del(result);
3779 3780
3780 _eet_freelist_all_unref(context); 3781 _eet_freelist_all_unref(context);
@@ -3832,14 +3833,17 @@ eet_data_get_list(Eet_Free_Context *context,
3832 size, 3833 size,
3833 on_error); 3834 on_error);
3834 else 3835 else
3835 STRUCT_TYPE_DECODE(data_ret, 3836 {
3836 context, 3837 STRUCT_TYPE_DECODE(data_ret,
3837 ed, 3838 context,
3838 subtype, 3839 ed,
3839 echnk->data, 3840 subtype,
3840 echnk->size, 3841 echnk->data,
3841 -1, 3842 echnk->size,
3842 on_error); 3843 -1,
3844 on_error);
3845 if (subtype) _eet_freelist_add(context, data_ret);
3846 }
3843 3847
3844 if (edd) 3848 if (edd)
3845 { 3849 {
@@ -3920,14 +3924,18 @@ eet_data_get_hash(Eet_Free_Context *context,
3920 size, 3924 size,
3921 on_error); 3925 on_error);
3922 else 3926 else
3923 STRUCT_TYPE_DECODE(data_ret, 3927 {
3924 context, 3928 STRUCT_TYPE_DECODE(data_ret,
3925 ed, 3929 context,
3926 ede ? ede->subtype : NULL, 3930 ed,
3927 echnk->data, 3931 ede ? ede->subtype : NULL,
3928 echnk->size, 3932 echnk->data,
3929 -1, 3933 echnk->size,
3930 on_error); 3934 -1,
3935 on_error);
3936
3937 if (ede ? ede->subtype : NULL) _eet_freelist_add(context, data_ret);
3938 }
3931 3939
3932 if (edd) 3940 if (edd)
3933 { 3941 {
@@ -4702,6 +4710,7 @@ eet_data_get_unknown(Eet_Free_Context *context,
4702 { 4710 {
4703 ptr = (void **)(((char *)data)); 4711 ptr = (void **)(((char *)data));
4704 *ptr = (void *)data_ret; 4712 *ptr = (void *)data_ret;
4713 _eet_freelist_add(context, data_ret);
4705 } 4714 }
4706 } 4715 }
4707 else 4716 else