summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-07-16 22:28:46 +0000
committerPaul Smith <psmith@gnu.org>1999-07-16 22:28:46 +0000
commitd6ed8c3e1cbab29a44bc9baa00432c33a3baa315 (patch)
tree52637452c6bb6a5b4fbb2fe49560abccb61e90aa
parentd5b476a1710b3ba0b85f0556b04b1c989b5e070b (diff)
downloadmake-d6ed8c3e1cbab29a44bc9baa00432c33a3baa315.tar.gz
* Fix some memory and file descriptor leaks.
-rw-r--r--.purify5
-rw-r--r--ChangeLog11
-rw-r--r--job.c4
-rw-r--r--read.c1
4 files changed, 19 insertions, 2 deletions
diff --git a/.purify b/.purify
new file mode 100644
index 00000000..098e741c
--- /dev/null
+++ b/.purify
@@ -0,0 +1,5 @@
+suppress plk malloc; setvbuf "libc*"; main "main.c"
+suppress mlk malloc; xmalloc "misc.c"; decode_env_switches "main.c"
+suppress plk malloc; xmalloc "misc.c"; decode_env_switches "main.c"
+suppress mlk malloc; xmalloc "misc.c"; concat "misc.c"; decode_env_switches "main.c"
+suppress plk malloc; xmalloc "misc.c"; concat "misc.c"; decode_env_switches "main.c"
diff --git a/ChangeLog b/ChangeLog
index 8288d775..3895a857 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1999-07-16 Paul D. Smith <psmith@gnu.org>
+
+ * .purify: New file: suppress some known-OK Purify messages.
+
+ * read.c (read_makefile): Remember to free the commands buffer if
+ we can't find a makefile.
+
+ * job.c (start_job_command): Broken #ifdef test: look for F_SETFD,
+ not FD_SETFD. Close-on-exec isn't getting set on the bad_stdin
+ file descriptor and it's leaking :-/.
+
1999-07-15 Paul D. Smith <psmith@gnu.org>
* read.c (read_makefile): Fix some potential memory stomps parsing
diff --git a/job.c b/job.c
index caabb1eb..e84897bf 100644
--- a/job.c
+++ b/job.c
@@ -897,7 +897,7 @@ start_job_command (child)
/* Set the descriptor to close on exec, so it does not litter any
child's descriptor table. When it is dup2'd onto descriptor 0,
that descriptor will not close on exec. */
-#ifdef FD_SETFD
+#ifdef F_SETFD
#ifndef FD_CLOEXEC
#define FD_CLOEXEC 1
#endif
@@ -980,7 +980,7 @@ start_job_command (child)
/* We are the child side. */
unblock_sigs ();
child_execute_job (child->good_stdin ? 0 : bad_stdin, 1,
- argv, child->environment);
+ argv, child->environment);
}
else if (child->pid < 0)
{
diff --git a/read.c b/read.c
index 4ac9745b..0a39ef64 100644
--- a/read.c
+++ b/read.c
@@ -396,6 +396,7 @@ read_makefile (filename, flags)
attempt, rather from FILENAME itself. Restore it in case the
caller wants to use it in a message. */
errno = makefile_errno;
+ free (commands);
return 0;
}