Skip to content

[MAJOR] §14: NatsConnection::fetch() returns raw natsMsg* with manual ownership #514

@mvillmow

Description

@mvillmow

Finding

Severity: MAJOR
Section: 14
Evidence: include/transport/nats_connection.hpp:302-303
Principle: POLA

fetch() returns a raw natsMsg* that the caller must destroy via natsMsg_Destroy(). This is an unsafe ownership transfer pattern in modern C++. A std::unique_ptr<natsMsg, decltype(&natsMsg_Destroy)> with natsMsg_Destroy as the deleter would make ownership explicit and prevent leaks. Raw pointer return in a C++20 codebase is a POLA violation.


Part of #504

Metadata

Metadata

Assignees

No one assigned

    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