Fix error from asan when built with clang

This commit is contained in:
Kovid Goyal
2023-08-07 11:46:18 +05:30
parent 1347d1ad47
commit 9af4d5e0fc

View File

@@ -47,8 +47,8 @@ void log_error(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
#define fatal(...) { log_error(__VA_ARGS__); exit(EXIT_FAILURE); }
static inline void cleanup_free(void *p) { free(*(void**)p); }
#define FREE_AFTER_FUNCTION __attribute__((cleanup(cleanup_free)))
static inline void cleanup_clear(void *p) { Py_XDECREF((PyObject *)p); }
#define DECREF_AFTER_FUNCTION __attribute__((cleanup(cleanup_clear)))
static inline void cleanup_decref(PyObject **p) { if(*p) { Py_DECREF(*p); *p = NULL;} }
#define DECREF_AFTER_FUNCTION __attribute__((cleanup(cleanup_decref)))
#define FREE_BUFFER_AFTER_FUNCTION __attribute__((cleanup(PyBuffer_Release)))
typedef unsigned long long id_type;