Skip to content

two potential memory leaks #482

@qingkaishi

Description

@qingkaishi

Hi guys

Here, it seems there are two memory leaks.

if (ss->udp_socket != TR_BAD_SOCKET && tr_variantDictFindRaw(&benc, TR_KEY_nodes, &raw, &len) && len % 6 == 0)
{
nodes = tr_memdup(raw, len);
}
if (ss->udp6_socket != TR_BAD_SOCKET && tr_variantDictFindRaw(&benc, TR_KEY_nodes6, &raw, &len6) && len6 % 18 == 0)
{
nodes6 = tr_memdup(raw, len6);
}

The pointers nodes and nodes6 in the above code point to two newly-allocated memory.

if (rc < 0)
{
goto fail;
}

If rc < 0 in the above code happens, it will go to the label fail, where nodes and nodes6 are not released.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions