Avoid a compiler warning by casting to non-const when calling free()