Prefer using `vector` to manual memory management.  You can achieve the equivalent of what you do here by making `mem` a `vector`, then doing
```C++
mem.resize(first.num_bytes()).
valid_mem_len = t->read_bytes_fallible(first.start,
			    mem.size(), mem.data());
```
It gets really nasty managing explicit `free / delete`s, and C++'s greatest feature RAII frees you from having to do that :).