[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-46-g81bda9

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-46-g81bda96
Date: Wed, 17 Aug 2011 21:55:21 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, stable-2.0 has been updated
       via  81bda963e969db7e2ecc878982286daa5b0aacff (commit)
      from  b8f191964e519807bb6d05ea0f2296a46d2144bd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 81bda963e969db7e2ecc878982286daa5b0aacff
Author: Andy Wingo <address@hidden>
Date:   Wed Aug 17 23:54:58 2011 +0200

    fix scm_tmpfile leak
    * libguile/posix.c (scm_tmpfile): Fix to actually close the new
      tmpfile, causing its deletion, while keeping an fd to the file open.
      Fixes a leak both in memory and disk space on POSIX systems; MINGW
      systems will leak however.  A FIXME for later.


Summary of changes:
 libguile/posix.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/libguile/posix.c b/libguile/posix.c
index 2923dc6..ea406ae 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1338,10 +1338,20 @@ SCM_DEFINE (scm_tmpfile, "tmpfile", 0, 0, 0,
 #define FUNC_NAME s_scm_tmpfile
   FILE *rv;
+  int fd;
   if (! (rv = tmpfile ()))
-  return scm_fdes_to_port (fileno (rv), "w+", SCM_BOOL_F);
+#ifndef __MINGW32__
+  fd = dup (fileno (rv));
+  fclose (rv);
+  fd = fileno (rv);
+  /* FIXME: leaking the file, it will never be closed! */
+  return scm_fdes_to_port (fd, "w+", SCM_BOOL_F);
 #undef FUNC_NAME

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]