Skip to content

Memory leak when reading co_code attribute of deepfrozen code objects  #93728

@kumaraditya303

Description

@kumaraditya303

Reproducer:

import os
os.path.join.__code__.co_code

Relevant Valgrind Report:

==21416== HEAP SUMMARY:
==21416==     in use at exit: 397 bytes in 1 blocks
==21416==   total heap usage: 19,728 allocs, 19,727 frees, 2,629,532 bytes allocated
==21416== 
==21416== 397 bytes in 1 blocks are still reachable in loss record 1 of 1
==21416==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21416==    by 0x2FA6DD: _PyMem_RawMalloc (obmalloc.c:101)
==21416==    by 0x2FC5CD: PyObject_Malloc (obmalloc.c:713)
==21416==    by 0x287BDC: _PyBytes_FromSize (bytesobject.c:103)
==21416==    by 0x2881A6: PyBytes_FromStringAndSize (bytesobject.c:136)
==21416==    by 0x29F609: _PyCode_GetCode (codeobject.c:1374)
==21416==    by 0x29F69B: code_getcode (codeobject.c:1728)
==21416==    by 0x2A31B2: getset_get (descrobject.c:202)
==21416==    by 0x2F86E6: _PyObject_GenericGetAttrWithDict (object.c:1269)
==21416==    by 0x2F8F14: PyObject_GenericGetAttr (object.c:1357)
==21416==    by 0x2F9864: PyObject_GetAttr (object.c:912)
==21416==    by 0x3B5B16: _PyEval_EvalFrameDefault (ceval.c:3472)
==21416== 
==21416== LEAK SUMMARY:
==21416==    definitely lost: 0 bytes in 0 blocks
==21416==    indirectly lost: 0 bytes in 0 blocks
==21416==      possibly lost: 0 bytes in 0 blocks
==21416==    still reachable: 397 bytes in 1 blocks
==21416==         suppressed: 0 bytes in 0 blocks
==21416== 

This is a 3.12 only regression caused by #93382.

Metadata

Metadata

Labels

3.12only security fixes

Projects

No projects

Milestone

No 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