libXfont: Changes to 'master'
Alan Coopersmith
alanc at kemper.freedesktop.org
Fri Dec 13 14:15:34 PST 2013
src/FreeType/ftfuncs.c | 9 ++++++---
src/util/atom.c | 20 ++++++++++++--------
2 files changed, 18 insertions(+), 11 deletions(-)
New commits:
commit 0d24378a6f08f5ab594ff552d60cf5f8f74bcb33
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sat Dec 7 20:11:29 2013 -0800
Don't leak old allocation if realloc fails to enlarge it
In ftfuncs.c, since the buffer being reallocated is a function local
buffer, used to accumulate data for a single run of the function and
then freed at the end of the function, we just free the old buffer if
realloc fails.
In atom.c however, the ReverseMap is a static buffer, so we operate in
temporary variables until we know we're successful, then update the
static variables. If we fail, we leave the old static variables in place,
since they contain data about previous atoms we should maintain, not lose.
Reported by cppcheck:
[lib/libXfont/src/FreeType/ftfuncs.c:2122]: (error) Common realloc mistake:
'ranges' nulled but not freed upon failure
[lib/libXfont/src/util/atom.c:126]: (error) Common realloc mistake:
'reverseMap' nulled but not freed upon failure
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
More information about the xorg-commit
mailing list