diff options
author | Colin Watson <cjwatson@canonical.com> | 2013-01-29 13:57:53 +0000 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2013-01-29 15:08:18 +0100 |
commit | b59d9848d40ded74a6ae71d1bc7b912a904da435 (patch) | |
tree | f2506542d34de4cac42605b702bc89673762d95f | |
parent | 60732b12d64c52e92e534dc9f711f414f2e0d41f (diff) | |
download | upower-b59d9848d40ded74a6ae71d1bc7b912a904da435.tar.gz |
Fix two memory leaks
up_device_supply_get_design_voltage(): up_device_supply_get_string() returns a
newly allocated copy.
up_history_finalize(): Forgot to free history->priv->dir
https://bugs.freedesktop.org/show_bug.cgi?id=60019
-rw-r--r-- | src/linux/up-device-supply.c | 3 | ||||
-rw-r--r-- | src/up-history.c | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index 309c0e3..8462673 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -374,7 +374,7 @@ static gdouble up_device_supply_get_design_voltage (const gchar *native_path) { gdouble voltage; - const gchar *device_type; + gchar *device_type = NULL; /* design maximum */ voltage = sysfs_get_double (native_path, "voltage_max_design") / 1000000.0; @@ -416,6 +416,7 @@ up_device_supply_get_design_voltage (const gchar *native_path) g_warning ("no voltage values, using 10V as approximation"); voltage = 10.0f; out: + g_free (device_type); return voltage; } diff --git a/src/up-history.c b/src/up-history.c index 08e101b..cd16f36 100644 --- a/src/up-history.c +++ b/src/up-history.c @@ -922,6 +922,7 @@ up_history_finalize (GObject *object) g_ptr_array_unref (history->priv->data_time_empty); g_free (history->priv->id); + g_free (history->priv->dir); g_return_if_fail (history->priv != NULL); |