Changes from arch/CVS synchronization
authorLudovic Courtès <ludo@gnu.org>
Sun, 2 Sep 2007 10:55:58 +0000 (10:55 +0000)
committerLudovic Courtès <ludo@gnu.org>
Sun, 2 Sep 2007 10:55:58 +0000 (10:55 +0000)
ChangeLog
NEWS
libguile/ChangeLog
libguile/socket.c

index e36ac56..c87193e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-09-02  Ludovic Courtès  <ludo@gnu.org>
+
+       * NEWS: Mention memory leak fix in `make-socket-address'.
+
 2007-09-01  Ludovic Courtès  <ludo@gnu.org>
 
        * NEWS: Mention duplicate binding warnings to stderr.
diff --git a/NEWS b/NEWS
index 21a20a1..aa27810 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -43,6 +43,7 @@ Changes in 1.8.3 (since 1.8.2)
 
 ** Expressions like "(set! 'x #t)" no longer yield a crash
 ** Warnings about duplicate bindings now go to stderr
+** A memory leak in `make-socket-address' was fixed
 ** Build problems on Solaris fixed
 
 * Implementation improvements
index d7e1ced..215db26 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-02  Ludovic Courtès  <ludo@gnu.org>
+
+       * socket.c (scm_make_socket_address): Free C_ADDRESS after use.
+       This fixes a memory leak.
+
 2007-08-26  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
        * fports.c gc-card.c gc.c gc.h ioext.c ports.c ports.h weaks.h
index 4ee8a84..d92607f 100644 (file)
@@ -1262,15 +1262,19 @@ SCM_DEFINE (scm_make_socket_address, "make-socket-address", 2, 0, 1,
            "@code{connect} for details).")
 #define FUNC_NAME s_scm_make_socket_address
 {
+  SCM result = SCM_BOOL_F;
   struct sockaddr *c_address;
   size_t c_address_size;
 
   c_address = scm_c_make_socket_address (family, address, args,
                                         &c_address_size);
-  if (!c_address)
-    return SCM_BOOL_F;
+  if (c_address != NULL)
+    {
+      result = scm_from_sockaddr (c_address, c_address_size);
+      free (c_address);
+    }
 
-  return (scm_from_sockaddr (c_address, c_address_size));
+  return result;
 }
 #undef FUNC_NAME