fix shared memory leak