Mercurial > cpython-lru_cache-weakref
view Python/asdl.c @ 37034:fff4eecdef45 legacy-trunk
Fix a leak that would happen under error conditions (found by Coverty).
| author | Thomas Heller <theller@ctypes.org> |
|---|---|
| date | Thu, 16 Mar 2006 20:02:36 +0000 |
| parents | 45e6f901902c |
| children | 5e72b0c74100 f731859e9b3b |
line wrap: on
line source
#include "Python.h" #include "asdl.h" asdl_seq * asdl_seq_new(int size, PyArena *arena) { asdl_seq *seq = NULL; size_t n = sizeof(asdl_seq) + (size ? (sizeof(void *) * (size - 1)) : 0); seq = (asdl_seq *)PyArena_Malloc(arena, n); if (!seq) { PyErr_NoMemory(); return NULL; } memset(seq, 0, n); seq->size = size; return seq; }
