Fix major memory stompage when using ecore_xcb_atom routines.

Thanks TAsn ;)

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 83807
This commit is contained in:
Christopher Michael 2013-02-11 07:12:18 +00:00 committed by Christopher Michael
parent ec7a42b204
commit 036a067a2c
1 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,8 @@
/* local variables */ /* local variables */
static xcb_intern_atom_cookie_t cookies[ECORE_X_ATOMS_COUNT]; static xcb_intern_atom_cookie_t cookies[ECORE_X_ATOMS_COUNT];
#define MYMIN(X, Y) (((X) < (Y)) ? (X) : (Y))
void void
_ecore_xcb_atoms_init(void) _ecore_xcb_atoms_init(void)
{ {
@ -18,6 +20,7 @@ _ecore_xcb_atoms_init(void)
CHECK_XCB_CONN; CHECK_XCB_CONN;
num = (sizeof(atom_items) / sizeof(Atom_Item)); num = (sizeof(atom_items) / sizeof(Atom_Item));
num = MYMIN(num, ECORE_X_ATOMS_COUNT);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
cookies[i] = cookies[i] =
@ -35,6 +38,7 @@ _ecore_xcb_atoms_finalize(void)
CHECK_XCB_CONN; CHECK_XCB_CONN;
num = (sizeof(atom_items) / sizeof(Atom_Item)); num = (sizeof(atom_items) / sizeof(Atom_Item));
num = MYMIN(num, ECORE_X_ATOMS_COUNT);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
xcb_intern_atom_reply_t *reply = NULL; xcb_intern_atom_reply_t *reply = NULL;
@ -131,6 +135,7 @@ ecore_x_atoms_get(const char **names,
LOGFN(__FILE__, __LINE__, __FUNCTION__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
CHECK_XCB_CONN; CHECK_XCB_CONN;
num = MYMIN(num, ECORE_X_ATOMS_COUNT);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
cookies[i] = cookies[i] =