| 2248 | } |
| 2249 | |
| 2250 | void Memory::free(const expr &ptr, bool unconstrained) { |
| 2251 | assert(!memory_unused()); |
| 2252 | Pointer p(*this, ptr); |
| 2253 | expr isnnull = p.isNull(); |
| 2254 | |
| 2255 | if (!unconstrained) |
| 2256 | state->addUB(isnnull || (p.getOffset() == 0 && |
| 2257 | p.isBlockAlive() && |
| 2258 | p.getAllocType() == Pointer::MALLOC)); |
| 2259 | |
| 2260 | if (!isnnull.isTrue()) { |
| 2261 | // A nonlocal block for encoding fn calls' side effects cannot be freed. |
| 2262 | ensure_non_fncallmem(p); |
| 2263 | store_bv(p, false, local_block_liveness, non_local_block_liveness, false, |
| 2264 | !isnnull); |
| 2265 | } |
| 2266 | } |
| 2267 | |
| 2268 | unsigned Memory::getStoreByteSize(const Type &ty) { |
| 2269 | assert(bits_program_pointer != 0); |
no test coverage detected