Browse Source

Merge branch 'bugfix/fix_mcpwm_example_memory_bug' into 'master'

Bugfix(example) : Fixed the bug that the malloc memory size is smaller than the actual required.

Closes IDFGH-1490

See merge request espressif/esp-idf!5509
Angus Gratton 6 years ago
parent
commit
4732e22e64

+ 2 - 2
examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c

@@ -137,8 +137,8 @@ static void gpio_test_signal(void *arg)
  */
 static void disp_captured_signal(void *arg)
 {
-    uint32_t *current_cap_value = (uint32_t *)malloc(sizeof(CAP_SIG_NUM));
-    uint32_t *previous_cap_value = (uint32_t *)malloc(sizeof(CAP_SIG_NUM));
+    uint32_t *current_cap_value = (uint32_t *)malloc(CAP_SIG_NUM*sizeof(uint32_t));
+    uint32_t *previous_cap_value = (uint32_t *)malloc(CAP_SIG_NUM*sizeof(uint32_t));
     capture evt;
     while (1) {
         xQueueReceive(cap_queue, &evt, portMAX_DELAY);