The dump API currently has a memory leak:
It's not trivial to fix this leak, since we are calling:
and the memory leaked is that returned in valuep. I think we should remove the const from the API, and document that the user is responsible for freeing thre returned string. I've opened an issue, since this is an API change and I could be missing a subtlety.
I made a naive fix for this here:
That fix fails testing due to the constness of the value variable (which I could cast away, but I don't think that is the right solution).