diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2019-12-04 02:18:31 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2019-12-04 02:18:31 +0100 |
commit | f07986d7ab356c37e54086aa0b4a2a97a7f821a7 (patch) | |
tree | b60441d3fda6e8998c643ec40c8d556a5dab5a18 /src | |
parent | Better code, removed some leaks (diff) | |
download | lowbat-gnu-f07986d7ab356c37e54086aa0b4a2a97a7f821a7.tar.gz lowbat-gnu-f07986d7ab356c37e54086aa0b4a2a97a7f821a7.tar.bz2 lowbat-gnu-f07986d7ab356c37e54086aa0b4a2a97a7f821a7.tar.xz lowbat-gnu-f07986d7ab356c37e54086aa0b4a2a97a7f821a7.tar.zst lowbat-gnu-f07986d7ab356c37e54086aa0b4a2a97a7f821a7.zip |
No more leaks
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 80fe04e..590f2d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,7 @@ using namespace this_thread; using namespace chrono; int main(int argc, const char *argv[]) { - string msg; + string* msg; string acstat; string batlvl; string arg_one; @@ -30,12 +30,13 @@ int main(int argc, const char *argv[]) { if (strcmp(arg_one.c_str(), "--silent")) { if (argc > 2 && !strcmp(arg_one.c_str(), "--say")) { arg_two = argv[2]; - msg = arg_two; + msg = new string(arg_two); } else { - msg = "beep beep - low battery"; + msg = new string("beep beep - low battery"); } - jo_speak(msg); + jo_speak(*msg); + delete msg; } sleep_for(seconds(20)); acstat.clear(); |