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.
This commit is contained in:
parent
ba54a2026b
commit
d7e7a02a62
4 changed files with 22 additions and 6 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue