Fixed compile error for GCC<4.6, stopped freeing of undefined variable in certain cases