summaryrefslogtreecommitdiff
path: root/lib/libX11/modules/im/ximcp/imLcIm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libX11/modules/im/ximcp/imLcIm.c')
-rw-r--r--lib/libX11/modules/im/ximcp/imLcIm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libX11/modules/im/ximcp/imLcIm.c b/lib/libX11/modules/im/ximcp/imLcIm.c
index 83f216a75..904169830 100644
--- a/lib/libX11/modules/im/ximcp/imLcIm.c
+++ b/lib/libX11/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);