From 605dfc3f2b99593f0f5d408ca6639a7ad90e649c Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 1 Apr 2024 13:10:56 -0700 Subject: [PATCH] Add suggested fix --- src/NMEA_build.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NMEA_build.cpp b/src/NMEA_build.cpp index 355b962..fadfd90 100644 --- a/src/NMEA_build.cpp +++ b/src/NMEA_build.cpp @@ -571,7 +571,8 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource, if (nmeaWithCRLF) { strcpy(nmeaWithCRLF, nmea); // Copy original string 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