projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixing a memory leak in the "fgHintPresent" function per e-mail from John Tsiombikas...
[freeglut]
/
src
/
freeglut_init.c
diff --git
a/src/freeglut_init.c
b/src/freeglut_init.c
index
57bb020
..
194248a
100644
(file)
--- 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)
{
/* 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;
int number_of_atoms;
int supported;
int i;
supported = 0;
- atoms_ptr = malloc(sizeof(Atom *));
number_of_atoms = fghGetWindowProperty(window,
property,
XA_ATOM,
number_of_atoms = fghGetWindowProperty(window,
property,
XA_ATOM,
- (unsigned char **) atoms_ptr);
+ (unsigned char **) &atoms);
for (i = 0; i < number_of_atoms; i++)
for (i = 0; i < number_of_atoms; i++)
- {
- if ((*atoms_ptr)[i] == hint)
+ {
+ if (atoms[i] == hint)
{
supported = 1;
break;
}
{
supported = 1;
break;
}
- }
+ }
+ XFree(atoms);
return supported;
}
return supported;
}