You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
QR decode: memleak might be fixed
This commit is contained in:
@@ -142,7 +142,8 @@ 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_OBJ_NULL;
|
||||
mp_obj_t result = mp_const_none;
|
||||
nlr_buf_t exception_handler;
|
||||
if (nlr_push(&exception_handler) == 0) {
|
||||
result = qrdecode(3, gray_args);
|
||||
@@ -152,8 +153,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);
|
||||
nlr_pop();
|
||||
nlr_raise(exception_handler.ret_val);
|
||||
//nlr_pop();
|
||||
//nlr_raise(exception_handler.ret_val);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -54,12 +54,15 @@ def qrdecode_live():
|
||||
try:
|
||||
import qrdecode
|
||||
result = qrdecode.qrdecode_rgb565(current_cam_buffer, width, height)
|
||||
#raise ValueError('A very specific bad thing happened.')
|
||||
result = remove_bom(result)
|
||||
result = print_qr_buffer(result)
|
||||
print(f"QR decoding found: {result}")
|
||||
status_label_text = result
|
||||
stop_qr_decoding()
|
||||
if not result:
|
||||
status_label_text = status_label_text_searching
|
||||
else:
|
||||
#raise ValueError('A very specific bad thing happened.')
|
||||
result = remove_bom(result)
|
||||
result = print_qr_buffer(result)
|
||||
print(f"QR decoding found: {result}")
|
||||
status_label_text = result
|
||||
stop_qr_decoding()
|
||||
except ValueError as e:
|
||||
print("QR ValueError: ", e)
|
||||
status_label_text = status_label_text_searching
|
||||
|
||||
Reference in New Issue
Block a user