The filters `apply_to` implementations are expected to allocate the `char *`, and passing it back to the caller. Freeing it will eventually be done by the caller (`git_filters__apply()`):
- When several filters are applied one after the other, the output of the previous one becomes the input of the next one. The intermediary allocated `char *` must be `free`d by `git_filters__apply()` (this is what happens [here](https://github.com/libgit2/libgit2/pull/1618/files#L10R83))
- However, the last one is not freed by `git_filters__apply()`, because it is the one that is actually being "returned" in the `git_buf *dest` that was passed to this function.

This was actually the tricky part of this PR. I eventually ended up with a solution which doesn't seem to leak memory, but maybe there is a more natural way to do it?