Skip to content

Commit eccc088

Browse files
committed
Add guards to common_hal_pulseio_pulse(in|out)_deinit to prevent double release of released resources.
1 parent 2896394 commit eccc088

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

ports/espressif/common-hal/pulseio/PulseIn.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t *self) {
127127
}
128128

129129
void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) {
130+
if (common_hal_pulseio_pulsein_deinited(self)) {
131+
return;
132+
}
130133
rmt_disable(self->channel);
131134
reset_pin_number(self->pin->number);
132135
rmt_del_channel(self->channel);

ports/espressif/common-hal/pulseio/PulseOut.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t *self) {
5454
}
5555

5656
void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t *self) {
57+
if (common_hal_pulseio_pulseout_deinited(self)) {
58+
return;
59+
}
5760
rmt_disable(self->channel);
5861
rmt_del_encoder(self->encoder);
5962
rmt_del_channel(self->channel);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy