Scope guards allow executing statements at certain conditions if the current block is left.
import core.stdc.stdlib; void main() { int* p = cast(int*)malloc(int.sizeof); scope(exit) free(p); }