summaryrefslogtreecommitdiff
path: root/src/AsciiSrc.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-21 15:49:33 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-04-21 15:55:18 -0700
commit26fb314644fd01928fc881e72e36b2c6bdda5b3b (patch)
tree447300359b44b908386d1bcbd9234fb4aa2ad24c /src/AsciiSrc.c
parenta5630e166921b5b5322b30fb152df01bb6536e42 (diff)
downloadxorg-lib-libXaw-26fb314644fd01928fc881e72e36b2c6bdda5b3b.tar.gz
Fix fd leak when fdopen() fails in InitStringOrFile()
Found by parfait 1.1p2 bug checking tool: File Descriptor Leak: Leaked File Descriptor fd at line 1507 of src/AsciiSrc.c in function 'InitStringOrFile'. fd initialized at line 1488 with open fd leaks when open(src->ascii_src.string, open_mode, 438) != -1 at line 1488. at line 1276 of src/MultiSrc.c in function 'InitStringOrFile'. fd initialized at line 1257 with open fd leaks when open(src->multi_src.string, open_mode, 438) != -1 at line 1257. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/AsciiSrc.c')
-rw-r--r--src/AsciiSrc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c
index b28b2c4..a37b6a1 100644
--- a/src/AsciiSrc.c
+++ b/src/AsciiSrc.c
@@ -1491,6 +1491,8 @@ InitStringOrFile(AsciiSrcObject src, Bool newString)
src->ascii_src.length = (XawTextPosition)ftell(file);
return (file);
}
+ else
+ close(fd);
}
{
String params[2];