From b70202eabd855982c1656e66b1c8cb1b05e2bef1 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Thu, 15 May 2025 16:48:05 +0200 Subject: [PATCH] QR decode: memory leak on ESP32 is fixed! --- c_mpos/src/quirc_decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c_mpos/src/quirc_decode.c b/c_mpos/src/quirc_decode.c index d4383e28..68bcccb9 100644 --- a/c_mpos/src/quirc_decode.c +++ b/c_mpos/src/quirc_decode.c @@ -142,7 +142,6 @@ static mp_obj_t qrdecode_rgb565(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_new_int(height) }; - //mp_obj_t result = MP_OBJ_NULL; mp_obj_t result = mp_const_none; nlr_buf_t exception_handler; if (nlr_push(&exception_handler) == 0) { @@ -153,6 +152,8 @@ static mp_obj_t qrdecode_rgb565(mp_uint_t n_args, const mp_obj_t *args) { } else { QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Exception caught, freeing gray_buffer\n"); free(gray_buffer); + // Re-raising the exception results in an Unhandled exception in thread started by + // which isn't caught, even when catching Exception, so this looks like a bug in MicroPython... //nlr_pop(); //nlr_raise(exception_handler.ret_val); }