8000 Fix NULL pointer exception in audiopwmio · tannewt/circuitpython@e3c4aeb · GitHub < 8000 meta name="theme-color" content="#1e2327">
[go: up one dir, main page]

Skip to content

Commit e3c4aeb

Browse files
committed
Fix NULL pointer exception in audiopwmio
active_audio was set to NULL, but then used in the following set_pin() call. because of MPU, this triggered hard fault on the stm32h7.
1 parent f72fffd commit e3c4aeb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ports/stm/common-hal/audiopwmio/PWMAudioOut.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ void common_hal_audiopwmio_pwmaudioout_stop(audiopwmio_pwmaudioout_obj_t *self)
342342
tim_handle.Instance->CR1 &= ~TIM_CR1_CEN;
343343
stm_peripherals_timer_free(tim_handle.Instance);
344344

345-
active_audio = NULL;
346345
self->stopping = false;
347346
self->paused = false;
348347

@@ -352,6 +351,8 @@ void common_hal_audiopwmio_pwmaudioout_stop(audiopwmio_pwmaudioout_obj_t *self)
352351
set_pin(1, GPIO_PIN_RESET);
353352
}
354353

354+
active_audio = NULL;
355+
355356
// Cannot free buffers here because we may be called from
356357
// the interrupt handler, and the heap is not reentrant.
357358
}

0 commit comments

Comments
 (0)
0