Skip to content

Commit b70202e

Browse files
QR decode: memory leak on ESP32 is fixed!
1 parent 6432b65 commit b70202e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

c_mpos/src/quirc_decode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ static mp_obj_t qrdecode_rgb565(mp_uint_t n_args, const mp_obj_t *args) {
142142
mp_obj_new_int(height)
143143
};
144144

145-
//mp_obj_t result = MP_OBJ_NULL;
146145
mp_obj_t result = mp_const_none;
147146
nlr_buf_t exception_handler;
148147
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) {
153152
} else {
154153
QRDECODE_DEBUG_PRINT("qrdecode_rgb565: Exception caught, freeing gray_buffer\n");
155154
free(gray_buffer);
155+
// Re-raising the exception results in an Unhandled exception in thread started by <function qrdecode_live at 0x7f6f55af0680>
156+
// which isn't caught, even when catching Exception, so this looks like a bug in MicroPython...
156157
//nlr_pop();
157158
//nlr_raise(exception_handler.ret_val);
158159
}

0 commit comments

Comments
 (0)