Add suggested fix

This commit is contained in:
Melissa LeBlanc-Williams 2024-04-01 13:10:56 -07:00
parent 792e13d2b2
commit 605dfc3f2b
1 changed files with 2 additions and 1 deletions

View File

@ -571,7 +571,8 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource,
if (nmeaWithCRLF) { if (nmeaWithCRLF) {
strcpy(nmeaWithCRLF, nmea); // Copy original string strcpy(nmeaWithCRLF, nmea); // Copy original string
strcat(nmeaWithCRLF, "\r\n"); // Append \r\n strcat(nmeaWithCRLF, "\r\n"); // Append \r\n
return nmeaWithCRLF; // return pointer to finished product strcpy(nmea, nmeaWithCRLF); // Copy back to original buffer
free(nmeaWithCRLF); // Free the allocated memory
} }
} }
return nmea; // return pointer to finished product return nmea; // return pointer to finished product