aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2019-12-04 02:18:31 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2019-12-04 02:18:31 +0100
commitf07986d7ab356c37e54086aa0b4a2a97a7f821a7 (patch)
treeb60441d3fda6e8998c643ec40c8d556a5dab5a18 /src
parentBetter code, removed some leaks (diff)
downloadlowbat-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.cpp9
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();