| 227 | } |
| 228 | |
| 229 | static inline void free_linear_object(linear_object *linear) { |
| 230 | // Only finalize `object_ref` if `linear` is the latest linear object reference |
| 231 | // or if the finalizer was forcibly set as allowed. By doing this, we avoid |
| 232 | // double-free attempts. |
| 233 | if (LEAN_UNLIKELY(!linear->outdated || linear->finalize_even_if_outdated)) { |
| 234 | linear->finalizer(linear->object_ref); |
| 235 | } |
| 236 | free(linear); |
| 237 | } |
| 238 | |
| 239 | /* --- API to implement Lean objects --- */ |
| 240 |
no outgoing calls
no test coverage detected