pw_deinit() is not reentrant
pw_init()
tries to support multiple users in a single process by skipping processing if the initialised flag is already set. But pw_deinit()
frees everything on its first call.
Obviously this won't work if there are multiple independent components using the run-time library in the same process. In fact, it looks like calling it is not possible to recover from pw_deinit()
at all, as it won't reset the initialised flag to false.
This leaves library code between a rock and a hard place. Don't call pw_deinit()
and you'll leak resources. Do call it and everything breaks down.