From: robertlipe Date: Sun, 10 Feb 2013 03:38:11 +0000 (+0000) Subject: Fix use-after-free of temp in gbfile. That gets Ubuntu back to a happy place. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~657 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ca642cce6d9b7a9dfd2df7e0794e71e7fee8529f;p=gpsbabel.git Fix use-after-free of temp in gbfile. That gets Ubuntu back to a happy place. --- diff --git a/gpsbabel/gbfile.cc b/gpsbabel/gbfile.cc index 2cbd8edbb..376d2b2c8 100644 --- a/gpsbabel/gbfile.cc +++ b/gpsbabel/gbfile.cc @@ -28,6 +28,7 @@ #include #include #include +#include #if __WIN32__ @@ -779,9 +780,11 @@ gbfputs(const char* s, gbfile* file) int gbfputs(const QString& s, gbfile* file) { - const char* qs = s.toUtf8().data(); + const char* qs = xstrdup(s.toUtf8().data()); unsigned int l = strlen(qs); - return gbfwrite(qs, 1, l, file); + int rv = gbfwrite(qs, 1, l, file); + xfree(qs); + return rv; } /*