fixed memory leak (sensor name when specified by the
authorJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 17 Apr 2012 08:25:58 +0000 (08:25 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 17 Apr 2012 08:25:58 +0000 (08:25 +0000)
   configuration).

src/main.c

index 95163e0..89cf2b9 100644 (file)
@@ -308,8 +308,10 @@ static void associate_preferences(struct psensor **sensors)
 
                n = config_get_sensor_name(s->id);
 
-               if (n)
+               if (n) {
+                       free(s->name);
                        s->name = n;
+               }
 
                sensor_cur++;
        }
@@ -528,6 +530,8 @@ int main(int argc, char **argv)
        /* main loop */
        gtk_main();
 
+       log_debug("Quitting...");
+
        g_mutex_lock(ui.sensors_mutex);
 
        psensor_cleanup();
@@ -555,6 +559,8 @@ int main(int argc, char **argv)
 
        config_cleanup();
 
+       log_debug("Cleanup done, closing log");
+
        log_close();
 
        return 0;