[PATCH 06/16] Fix memory leaks on _XimWriteCachedDefaultTree error paths.
Ander Conselvan de Oliveira
ander.conselvan-de-oliveira at nokia.com
Wed Mar 30 06:11:59 PDT 2011
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
---
modules/im/ximcp/imLcIm.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/modules/im/ximcp/imLcIm.c b/modules/im/ximcp/imLcIm.c
index 83f216a..9041698 100644
--- a/modules/im/ximcp/imLcIm.c
+++ b/modules/im/ximcp/imLcIm.c
@@ -489,10 +489,13 @@ _XimWriteCachedDefaultTree(
/* This STILL might be racy on NFS */
if ( (fd = _XOpenFileMode (cachename, O_WRONLY | O_CREAT | O_EXCL,
- 0600)) < 0)
+ 0600)) < 0) {
+ Xfree(m);
return;
+ }
if (! (fp = fdopen (fd, "wb")) ) {
close (fd);
+ Xfree(m);
return;
}
fwrite (m, msize, 1, fp);
--
1.7.0.4
More information about the xorg-devel
mailing list