Fix malloc/free in recv

Signed-off-by: franchioping <franchioping@gmail.com>
This commit is contained in:
franchioping 2024-06-15 20:29:28 +01:00
parent fa831230d7
commit b973cce49b
1 changed files with 2 additions and 1 deletions

View File

@ -116,10 +116,11 @@ void loop() {
*/
char* data_string = (char*) malloc(radio.DATALEN+1);
if(data_string != NULL){
memcpy(data_string, radio)
memcpy(data_string, radio, radio.DATALEN);
data_string[radio.DATALEN] = '\0';
Serial.println(data_string);
free(data_string);
}else{
Serial.print("Failed to malloc string, not printing the packet");
}