Skip to content

android: Use an `OwnedFd` to prevent leaks.

Clara Engler requested to merge cve/onionmasq:dev/cve/ownedfd into main

This commit wraps the fd of type i32 to an OwnedFd in order to ensure that it gets properly dropped in both: success and error cases.

Previously, it was already properly dropped if things got wrong during and after the OnionTunnel::create_with_fd call, but not beforehand.

Now it gets wrapped around an OwnedFd in the first step, meaning that it will be properly closed in all cases.

This commit also adjusts the function prototypes in the onion-tunnel crate respectively in order to accept higher level arguments of file descriptors.

Fixes #116 (closed)

Merge request reports

Loading