diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-09-01 23:53:58 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-09-01 23:53:58 +0200 |
commit | d7e7a02a6251c8ed4f76933d9d30baeee3f599c0 (patch) | |
tree | 090c38e239a5a48501a3826552b8842c9bdb1d82 /libguile/srfi-4.c | |
parent | ba54a2026beaadb4e7566d4b9e2c9e4c7cd793e6 (diff) | |
download | guile-d7e7a02a6251c8ed4f76933d9d30baeee3f599c0.tar.gz |
Fix leaky behavior of `scm_take_TAGvector ()'.
* libguile/srfi-4.c (free_user_data): New function.
* libguile/srfi-4.i.c (scm_take_TAGvector): Register `free_user_data ()'
as a finalizer for DATA.
* libguile/objcodes.c (scm_objcode_to_bytecode): Allocate with
`scm_malloc ()' since the memory taken by `scm_take_u8vector ()' will
eventually be free(3)d.
* libguile/vm.c (really_make_boot_program): Likewise.
Diffstat (limited to 'libguile/srfi-4.c')
-rw-r--r-- | libguile/srfi-4.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c index de1130fb3..302414364 100644 --- a/libguile/srfi-4.c +++ b/libguile/srfi-4.c @@ -28,6 +28,7 @@ #include "libguile/_scm.h" #include "libguile/__scm.h" +#include "libguile/boehm-gc.h" #include "libguile/srfi-4.h" #include "libguile/bitvectors.h" #include "libguile/bytevectors.h" @@ -281,6 +282,14 @@ uvec_assert (int type, SCM obj) scm_wrong_type_arg_msg (NULL, 0, obj, uvec_names[type]); } +/* Invoke free(3) on DATA, a user-provided buffer passed to one of the + `scm_take_' functions. */ +static void +free_user_data (GC_PTR data, GC_PTR unused) +{ + free (data); +} + static SCM take_uvec (int type, void *base, size_t len) { |