]> granicus.if.org Git - esp-idf/commitdiff
Fixed the bug that the malloc memory size is smaller than the actual required.
authorRamesh <38435057+rmshub@users.noreply.github.com>
Wed, 10 Jul 2019 03:25:36 +0000 (08:55 +0530)
committerkooho <2229179028@qq.com>
Fri, 12 Jul 2019 01:51:41 +0000 (09:51 +0800)
Merges https://github.com/espressif/esp-idf/pull/3757

examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c

index 58fe18889ad882089b5f7603ccf0e6cd6002a106..7853c149054cd259c7d60c35678883adc656c1fe 100644 (file)
@@ -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);