diff --git a/.gitignore b/.gitignore index 7f492c3..ce22424 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,7 @@ test_output/ # Test image dumps (defense in depth) *.pgm -*.ppm \ No newline at end of file +*.ppm + +# Generic compiled output +a.out \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index eea90f1..831fd77 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace { @@ -73,6 +74,7 @@ int main() { LOG_ERROR("curl_global_init failed"); return 1; } + std::atexit(curl_global_cleanup); // ---- Load configuration ---- Config cfg; @@ -109,6 +111,7 @@ int main() { if (!oled.begin(cfg.oledI2CAddr)) { LOG_ERROR("Failed to open OLED on I2C bus at 0x" << std::hex << cfg.oledI2CAddr << std::dec); + close(lcdFd); return 1; } @@ -208,6 +211,5 @@ int main() { } } - curl_global_cleanup(); return 0; // unreachable -} \ No newline at end of file +}