[vm] added locks to frame.c. Also fixed frame_free