1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-23 03:54:12 +02:00

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:
Ludovic Courtès 2009-09-01 23:53:58 +02:00
parent ba54a2026b
commit d7e7a02a62
4 changed files with 22 additions and 6 deletions

View file

@ -229,8 +229,8 @@ SCM_DEFINE (scm_objcode_to_bytecode, "objcode->bytecode", 1, 0, 0,
SCM_VALIDATE_OBJCODE (1, objcode);
len = sizeof(struct scm_objcode) + SCM_OBJCODE_TOTAL_LEN (objcode);
/* FIXME: Is `gc_malloc' ok here? */
u8vector = scm_gc_malloc (len, "objcode-u8vector");
u8vector = scm_malloc (len);
memcpy (u8vector, SCM_OBJCODE_DATA (objcode), len);
return scm_take_u8vector (u8vector, len);