Yesterday within half an hour I hacked together C that will soon hit the CPAN. I simply put all the relevant C-functions from the findutils-package and butchered them into Locate.xs, massaged the whole thing a little to return the data to the caller and that was it essentially.
However, one thing is odd. There is not a single call to C within locate.c and related C files. So it allocates all the memory for the strings it extracts from the locate-db files (more than 12meg for a search for 'mp3' on my computer) but never frees them, benefiting from the fact that locate(2L) is shut-down afterwards anyway. Naturally, when turning that into a module, memory must be cleaned up properly and this turns out to be not that easy. It uses statically allocated memory at some places and my attempts to replace that with dynamic memory allocation have resulted in segfaults so far. Strange. I always though that it would be good style to always release the memory one allocated no matter whether this is necessary in a narrower sense.
Other than that, the style of the code is pretty ancient. It still uses K&R function-declaration style for instance and some other baddies and anachronisms.