From 20c326dd70f34697350611e53ad6fe5435b5240f Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Wed, 14 Dec 2011 03:40:52 +0000 Subject: [PATCH] Fixing a memory leak in the "fgHintPresent" function per e-mail from John Tsiombikas dated 12/13/11 6:22 PM git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@954 7f0cb862-5218-0410-a997-914c9d46530a --- src/freeglut_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 57bb020..194248a 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -211,27 +211,27 @@ static int fghNetWMSupported(void) /* Check if "hint" is present in "property" for "window". */ int fgHintPresent(Window window, Atom property, Atom hint) { - Atom ** atoms_ptr; + Atom *atoms; int number_of_atoms; int supported; int i; supported = 0; - atoms_ptr = malloc(sizeof(Atom *)); number_of_atoms = fghGetWindowProperty(window, property, XA_ATOM, - (unsigned char **) atoms_ptr); + (unsigned char **) &atoms); for (i = 0; i < number_of_atoms; i++) - { - if ((*atoms_ptr)[i] == hint) + { + if (atoms[i] == hint) { supported = 1; break; } - } + } + XFree(atoms); return supported; } -- 1.7.10.4