summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-04-10 09:18:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-04-10 09:19:59 -0700
commitc2ffd57727e5f02b94f1c46392a740e404d4c270 (patch)
treee294697db24e2f88eb5b043aa14d350d72978192
parent093d33fb6bc108030539b38c4bfa202b148d3c7a (diff)
downloadxorg-util-makedepend-c2ffd57727e5f02b94f1c46392a740e404d4c270.tar.gz
Close fd for reading old Makefile when done, instead of leaking it
Found by Oracle Parfait: Error: File Leak File Leak [file-ptr-leak]: Leaked File fdin at line 799 of main.c in function 'redirect'. fdin initialized at line 769 with fopen Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/main.c b/main.c
index 8715881..816243f 100644
--- a/main.c
+++ b/main.c
@@ -790,6 +790,7 @@ redirect(const char *line, const char *makefile)
fputs(buf, fdout);
}
}
+ fclose(fdin);
fflush(fdout);
#ifndef HAVE_FCHMOD
chmod(makefile, st.st_mode);