Skip to content

Memory leak in cfl_PyUnistr_AsUTF8 #198

@stephan-hof

Description

@stephan-hof

In confluent_kafka.h this function has the following definition: #define cfl_PyUnistr_AsUTF8(X) PyBytes_AsString(PyUnicode_AsUTF8String(X))

The problems is that PyUnicode_AsUTF8String returns a new reference which is never released via Py_DECREF later on. Which means the return value of PyUnicode_AsUTF8String leaks memory.

I know a proper fix is hard, because the Py_DECREF must be deferred to the point where the result of PyUnicode_AsUTF8String is not used any more (considering also error cases ..).

I did not have problems with this leak yet, because the places where it happens are not triggered often in my code. However as soon as this is called frequently, for example TopicPartition_str0 with an errstr set, it will have an impact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReporting an unexpected or problematic behavior of the codebase

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy