summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristopher Michael <cp.michael@samsung.com>2019-04-01 10:02:57 -0400
committerChristopher Michael <cp.michael@samsung.com>2019-04-01 10:02:57 -0400
commit83d4890c74a91f9f2a61b3e2e515fbab0da155c3 (patch)
treea7c9a186b65d685e7479f63bdf8e1527330cc45d /src/lib
parent750b21830fee07186a5523c1f90d220d743b0b48 (diff)
efl_ui_selection_manager: Don't leak malloc'd data
Summary: Coverity reports that we potentially leak char *s here. If we do not have 'data_ret', then the malloc'd 's' sould be freed as we are not going to use it. Fixes Coverity CID1396949 @fix Reviewers: raster, cedric, bu5hm4n, zmike Reviewed By: bu5hm4n Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8523
Diffstat (limited to '')
-rw-r--r--src/lib/elementary/efl_ui_selection_manager.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lib/elementary/efl_ui_selection_manager.c b/src/lib/elementary/efl_ui_selection_manager.c
index ef9d221d0d..cbef9226af 100644
--- a/src/lib/elementary/efl_ui_selection_manager.c
+++ b/src/lib/elementary/efl_ui_selection_manager.c
@@ -1142,15 +1142,20 @@ static Eina_Bool
1142_x11_vcard_send(char *target EINA_UNUSED, void *data EINA_UNUSED, int size EINA_UNUSED, void **data_ret, int *size_ret, Ecore_X_Atom *ttype EINA_UNUSED, int *typesize EINA_UNUSED) 1142_x11_vcard_send(char *target EINA_UNUSED, void *data EINA_UNUSED, int size EINA_UNUSED, void **data_ret, int *size_ret, Ecore_X_Atom *ttype EINA_UNUSED, int *typesize EINA_UNUSED)
1143{ 1143{
1144 Sel_Manager_Selection *sel; 1144 Sel_Manager_Selection *sel;
1145 char *s;
1146 1145
1147 sel_debug("Vcard send called"); 1146 sel_debug("Vcard send called");
1148 sel = *(Sel_Manager_Selection **)data; 1147 sel = *(Sel_Manager_Selection **)data;
1149 s = malloc(sel->data.len + 1); 1148 if (data_ret)
1150 if (!s) return EINA_FALSE; 1149 {
1151 memcpy(s, sel->data.mem, sel->data.len); 1150 char *s;
1152 s[sel->data.len] = 0; 1151
1153 if (data_ret) *data_ret = s; 1152 s = malloc(sel->data.len + 1);
1153 if (!s) return EINA_FALSE;
1154 memcpy(s, sel->data.mem, sel->data.len);
1155 s[sel->data.len] = 0;
1156 *data_ret = s;
1157 }
1158
1154 if (size_ret) *size_ret = sel->data.len; 1159 if (size_ret) *size_ret = sel->data.len;
1155 return EINA_TRUE; 1160 return EINA_TRUE;
1156} 1161}