Remove access to free'd memory in cmd_free

Fixes GitHub issue #73