espressif/esp32-arduino-lib-builder

mbedtls_calloc fail

HamzaHajeir opened this issue · 1 comments

Hi there,

I've found a possible bug wherein mbedtls is unable to allocate memory for its internals, maybe because of lack of configurations..

#include <Arduino.h>
#include "mbedtls/platform.h"
// put function declarations here:
void tryAlloc();

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  tryAlloc();
}

void loop() {
  // put your main code here, to run repeatedly:
}

void tryAlloc(){
	auto p = mbedtls_calloc(10,0);
	Serial.printf("mbedtls_calloc %s\n", p ? "SUCCEEDED" : "FAILED");
	if (p) {  mbedtls_free(p); }
}

PlatformIO configuration:

[env:esp32doit-devkit-v1]
platform = espressif32@6.3.1
board = esp32doit-devkit-v1
framework = arduino
monitor_speed = 115200

Output:

mbedtls_calloc FAILED

I'm going to close the issue as it's proven not to be with build system, MCVE is wrong wherein the provided size=0.