From eb30db6d7dedd0490e2a04f388d5044d4d21a221 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 2 Dec 2019 23:24:25 +0100 Subject: [PATCH] :art: Use gwion for clean2 --- src/gwion.c | 4 ++-- src/lib/shred.c | 2 +- tests/import/test.log | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tests/import/test.log diff --git a/src/gwion.c b/src/gwion.c index 4bb4c9db..8589d676 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -113,8 +113,8 @@ ANN static inline void free_gwion_cpy(const Gwion gwion, const VM_Shred shred) { ANN static void fork_clean2(const VM_Shred shred, const Vector v) { for(m_uint i = 0; i < vector_size(v); ++i) { - VM* vm = (VM*)vector_at(v, i); - free_gwion_cpy(vm->gwion, shred); + const Gwion gwion = (Gwion)vector_at(v, i); + free_gwion_cpy(gwion, shred); } vector_release(v); } diff --git a/src/lib/shred.c b/src/lib/shred.c index fd430fba..f25f028f 100644 --- a/src/lib/shred.c +++ b/src/lib/shred.c @@ -154,7 +154,7 @@ static DTOR(fork_dtor) { vector_rem2(&vm->gwion->data->child, (vtype)o); if(!vm->gwion->data->child2.ptr) vector_init(&vm->gwion->data->child2); - vector_add(&vm->gwion->data->child2, (vtype)ME(o)->info->vm); + vector_add(&vm->gwion->data->child2, (vtype)ME(o)->info->vm->gwion); } } diff --git a/tests/import/test.log b/tests/import/test.log new file mode 100644 index 00000000..23d7fa2b --- /dev/null +++ b/tests/import/test.log @@ -0,0 +1,15 @@ +op_already_imported.gw ==964533== Memcheck, a memory error detector +==964533== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==964533== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info +==964533== Command: ./../../gwion -p. -m dummy -d dummy op_already_imported.gw +==964533== Parent PID: 963027 +==964533== +==964533== +==964533== HEAP SUMMARY: +==964533== in use at exit: 0 bytes in 0 blocks +==964533== total heap usage: 869 allocs, 869 frees, 17,602,040 bytes allocated +==964533== +==964533== All heap blocks were freed -- no leaks are possible +==964533== +==964533== For lists of detected and suppressed errors, rerun with: -s +==964533== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) -- 2.43.0