diff options
author | Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> | 2011-03-24 19:48:44 +0200 |
---|---|---|
committer | Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> | 2011-04-13 11:05:59 +0300 |
commit | 0ace642a2d47265f01450bfa2b2fd48eb6956a83 (patch) | |
tree | a0fc8e5dddb1f7cba7635104368df86f9fdb50c5 /modules | |
parent | e29be94edbb58b3b8dab545377a710d1f73b61e0 (diff) |
Fix memory leaks on _XimWriteCachedDefaultTree error paths.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'modules')
-rw-r--r-- | 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); |