OpenVPN / openvpn3

OpenVPN 3 is a C++ class library that implements the functionality of an OpenVPN client, and is protocol-compatible with the OpenVPN 2.x branch.
https://openvpn.net
Other
998 stars 397 forks source link

memory leaks #220

Closed vazyme closed 2 years ago

vazyme commented 2 years ago

HI! I am using openvpn3 library in VC and found that there is a memory leak.

I simply inherited OpenVPNClient

class Client : public ClientAPI::OpenVPNClient {
    virtual bool pause_on_connection_timeout() override
    {
        return false;
    }

    virtual void event(const ClientAPI::Event& ev) override
    {}
    virtual void external_pki_cert_request(ClientAPI::ExternalPKICertRequest& certreq) override
    {}
    virtual void external_pki_sign_request(ClientAPI::ExternalPKISignRequest& signreq) override
    {}
    virtual void log(const ClientAPI::LogInfo& log) override
    {
        //std::cout << log.text << std::flush;
    }
}; 

ProfileMerge pm(fn, "ovpn", "", ProfileMerge::FOLLOW_FULL, ProfileParseLimits::MAX_LINE_SIZE, ProfileParseLimits::MAX_PROFILE_SIZE);

ClientAPI::Config config;
config.content = pm.profile_content();
config.wintun = true;

Client client;
//client.eval_config(config);
//client.connect();

Detected memory leaks! Dumping objects -> {1389} normal block at 0x00000259D3B248D0, 56 bytes long. Data: <( > 28 0A 93 01 FF 7F 00 00 00 00 00 00 01 00 00 00 Object dump complete.

But when I create a client object, there will be a memory leak, did I not notice anything?

I'm baffled Is there a problem with such a simple use?

vazyme commented 2 years ago
    ProfileMerge pm(fn, "ovpn", "", ProfileMerge::FOLLOW_FULL, ProfileParseLimits::MAX_LINE_SIZE, ProfileParseLimits::MAX_PROFILE_SIZE);

    ClientAPI::Config config;
    config.content = pm.profile_content();
    config.wintun = true;

    //Client client;
    //client.eval_config(config);
    //client.connect();

When the client object is not created, there is no leakage problem