This is something related to contexts.
Since you have one user application, you usually use the default context. It dies whenever a user session is destroyed, probably when your application should be closed.
Also note that you cannot leak simply because you do not call libusb_exit if your application crashes (well, although there may be a leak, the leaked memory will be released immediately after the failure, so I would not care more than about the cause of the accident itself )
The problem occurs when you have several sessions.
See here and here for more details.
If you do not call libusb_exit in this case, and the session is in the released state from the point of view of your application, you are of course about to leak memory because the context will not actually be destroyed by libusb. In fact, in this case, the software should not be shut down, but this memory is still in use and is no longer available since you did not call libusb_exit to release it.
That's why the documentation suggests calling libusb_exit every time you want to destroy the context, either by default or not.
skypjack
source share