Skip to content

Memory leaks in crypto code in error paths #738

@douglasism

Description

@douglasism

(Hello CCF, sorry to cause trouble.)

Description
In CCF-level crypto code, there are multiple examples of non-trivial ctors that throw exceptions without freeing resources thus far created. (When c++ objects fail during construction, the object's dtor will not be called.) For example, the class TlsClient's ctor calls member function connect(), which does quite a bit of work and throws exceptions on error. Any resources created in the ctor prior to the exception will not be freed.

ccf\src\clients\tls_client.h

There are other examples of this pattern in CCF's higher-level crypto code. (By "higher-level" I mean in CCF proper, that is, not in 3rd-party code.)

Expected behavior
Memory leaks will not occur, including during failure cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions