From 74ec52d85758ad9da7a3abb24257511b22d74964 Mon Sep 17 00:00:00 2001 From: Eric Poulsen Date: Thu, 26 Oct 2017 21:17:35 -0700 Subject: extmod/modussl: Add finaliser support for ussl objects. Per the comment found here https://github.com/micropython/micropython-esp32/issues/209#issuecomment-339855157, this patch adds finaliser code to prevent memory leaks from ussl objects, which is especially useful when memory for a ussl context is allocated outside the uPy heap. This patch is in-line with the finaliser code found in many modsocket implementations for various ports. This feature is configured via MICROPY_PY_USSL_FINALISER and is disabled by default because there may be issues using it when the ussl state *is* allocated on the uPy heap, rather than externally. --- py/mpconfig.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'py') diff --git a/py/mpconfig.h b/py/mpconfig.h index 1694a1360..6a32ea2a6 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1109,6 +1109,8 @@ typedef double mp_float_t; #ifndef MICROPY_PY_USSL #define MICROPY_PY_USSL (0) +// Whether to add finaliser code to ussl objects +#define MICROPY_PY_USSL_FINALISER (0) #endif #ifndef MICROPY_PY_WEBSOCKET -- cgit v1.2.3