diff options
author | Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> | 2011-03-24 19:48:44 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:26 +0200 |
commit | b7cc762ba5b2b724d9181bdf81870bac0e469554 (patch) | |
tree | 1e2189fc2227fbfaf9f8b88eff61da61294ca042 /nx-X11/lib/X11/imLcIm.c | |
parent | 7024f3d909b8637038d332940ae59b8679092279 (diff) | |
download | nx-libs-b7cc762ba5b2b724d9181bdf81870bac0e469554.tar.gz nx-libs-b7cc762ba5b2b724d9181bdf81870bac0e469554.tar.bz2 nx-libs-b7cc762ba5b2b724d9181bdf81870bac0e469554.zip |
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>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11/imLcIm.c')
-rw-r--r-- | nx-X11/lib/X11/imLcIm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nx-X11/lib/X11/imLcIm.c b/nx-X11/lib/X11/imLcIm.c index 81645e5bd..d0ce12d4d 100644 --- a/nx-X11/lib/X11/imLcIm.c +++ b/nx-X11/lib/X11/imLcIm.c @@ -491,10 +491,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); |