ecore_x/xcb: fix use of uninitialized var + leak--. Fix #1786

SVN revision: 82730
This commit is contained in:
Boris Faure 2013-01-13 14:11:42 +00:00
parent a7e55676fa
commit aa8a1eb727
3 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2013-01-13 Boris Faure (billiob)
* Fixed condition based on uninitialized value in ecore_x_selection
(both xlib and xcb).
* Fixed a leaked when no selection converter matches.
2013-01-11 Tom Hacohen (TAsn) 2013-01-11 Tom Hacohen (TAsn)
* Static libs: Updated liblinebreak to libunibreak's latest version. * Static libs: Updated liblinebreak to libunibreak's latest version.

View File

@ -449,7 +449,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection,
{ {
Ecore_X_Selection_Intern *sel; Ecore_X_Selection_Intern *sel;
Ecore_X_Selection_Converter *cnv; Ecore_X_Selection_Converter *cnv;
void *data; void *data = NULL;
char *tgt_str; char *tgt_str;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -461,7 +461,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection,
{ {
if (cnv->target == target) if (cnv->target == target)
{ {
int r = 0; int r;
r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
targtype, typesize); targtype, typesize);
@ -475,6 +475,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection,
return EINA_FALSE; return EINA_FALSE;
} }
} }
free(tgt_str);
return EINA_FALSE; return EINA_FALSE;
} }

View File

@ -545,7 +545,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection,
{ {
Ecore_X_Selection_Intern *sel; Ecore_X_Selection_Intern *sel;
Ecore_X_Selection_Converter *cnv; Ecore_X_Selection_Converter *cnv;
void *data; void *data = NULL;
char *tgt_str; char *tgt_str;
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -569,6 +569,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection,
return EINA_FALSE; return EINA_FALSE;
} }
} }
free(tgt_str);
/* ICCCM says "If the selection cannot be converted into a form based on the target (and parameters, if any), the owner should refuse the SelectionRequest as previously described." */ /* ICCCM says "If the selection cannot be converted into a form based on the target (and parameters, if any), the owner should refuse the SelectionRequest as previously described." */
return EINA_FALSE; return EINA_FALSE;