Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A tempText memleak #1057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void loop()
float temp = tmp006.readObjTempC();
char* tempText;
char ii;
tempText = (char*) malloc(10);
tempText = (char*) malloc(10);//WHY NOT USE stack memory char tempText[10]?
for (ii=0;ii<10;ii++)
tempText[ii] = 0;
tempText = ftoa(tempText, temp, 4);
Expand All @@ -484,6 +484,8 @@ void loop()
myScreen.gText(60,20, "*C", colour);

myScreen.gText(0,40, " RGB LED Test", blueColour);
free(tempText);//DO NOT use tempText any more.

//TEST OPT3001 LIGHT SENSOR
//To be enabled once OPT3001 is added to future Edu BP MK II Rev.
// Serial.println("Cover the light sensor to test the OPT3001.");
Expand Down