static int l_channel_close (lua_State *L) {
    return channel_close(L, 0, 0);
}

The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations.