| 1070 | } |
| 1071 | |
| 1072 | void das_context_free ( das_context * context, void * ptr, uint32_t size ) { |
| 1073 | if ( !ptr ) return; |
| 1074 | if ( !size ) { |
| 1075 | // Some heap impls handle free(ptr, 0) cleanly, others assert. The C |
| 1076 | // contract requires `size` to match the allocation — fail loud rather |
| 1077 | // than silently corrupt the heap accounting. |
| 1078 | ((Context *)context)->throw_error("das_context_free: size must be non-zero when ptr is non-null"); |
| 1079 | return; |
| 1080 | } |
| 1081 | ((Context *)context)->free((char *)ptr, size, nullptr); |
| 1082 | } |
| 1083 | |
| 1084 | // --- Context heap (64-bit size) --- |
| 1085 |
no test coverage detected