Free alloc'd memory fix for invoke_if()