@revk So it'll either give you back a pointer you passed in, or a newly allocated pointer - but you know what pointers you pass in, so you can tell which are allocated by the library to ensure you free them?
When it comes to tidying up, the pedant in me wants to and it makes debugging easier, but it's wasted effort if you're not currently running in Valgrind. Could be worth only toggling on based on an environment variable?