1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-04 22:40:25 +02:00

Changes from arch/CVS synchronization

This commit is contained in:
Ludovic Courtès 2007-06-25 22:25:22 +00:00
parent 2778269600
commit d3075c52ac
8 changed files with 62 additions and 25 deletions

View file

@ -1,3 +1,11 @@
2007-06-26 Ludovic Courtès <ludo@gnu.org>
* fluids.c (next_fluid_num): When growing ALLOCATED_FLUIDS, make
sure to free the previous array after the new one has been
installed. This leak is made visible by running
"(define l (map (lambda (i) (make-fluid)) (iota 255)))"
from the REPL within Valgrind.
2007-06-12 Ludovic Courtès <ludo@chbouib.org>
* socket.c (scm_inet_ntop): In the `AF_INET' case, declare `addr4'

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1996,1997,2000,2001, 2004, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1996,1997,2000,2001, 2004, 2006, 2007 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -226,7 +226,8 @@ next_fluid_num ()
no GC can run while updating these two variables.
*/
char *new_allocated_fluids =
char *prev_allocated_fluids;
char *new_allocated_fluids =
scm_malloc (allocated_fluids_len + FLUID_GROW);
/* Copy over old values and initialize rest. GC can not run
@ -236,9 +237,14 @@ next_fluid_num ()
memcpy (new_allocated_fluids, allocated_fluids, allocated_fluids_len);
memset (new_allocated_fluids + allocated_fluids_len, 0, FLUID_GROW);
n = allocated_fluids_len;
prev_allocated_fluids = allocated_fluids;
allocated_fluids = new_allocated_fluids;
allocated_fluids_len += FLUID_GROW;
if (prev_allocated_fluids != NULL)
free (prev_allocated_fluids);
/* Now allocated_fluids and allocated_fluids_len are valid again
and we can allow GCs to occur.
*/