summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-11-17 21:44:27 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-11-18 10:30:40 +0100
commit15154e1d9759dfeeb161b9339d9e25592129e9d6 (patch)
tree610fe9adcba216441d52e787d9bb219cf38974bb
parent5a4e0f36d0be098e8bbc71e30789cadc0032879d (diff)
downloadupower-15154e1d9759dfeeb161b9339d9e25592129e9d6.tar.gz
daemon: plug huge memleak in GetStatistics
Reproducible by executing `upower -d` or by calling the DBus method org.freedesktop.UPower.Device.GetStatistics(charging). up_device_get_statistics -> up_history_get_profile_data -> up_stats_item_new. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--src/up-history.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/up-history.c b/src/up-history.c
index 4ed55fc..1d41c2c 100644
--- a/src/up-history.c
+++ b/src/up-history.c
@@ -299,7 +299,7 @@ up_history_get_profile_data (UpHistory *history, gboolean charging)
g_return_val_if_fail (UP_IS_HISTORY (history), NULL);
/* create 100 item list and set to zero */
- data = g_ptr_array_new ();
+ data = g_ptr_array_new_full (101, g_object_unref);
for (i=0; i<101; i++) {
stats = up_stats_item_new ();
g_ptr_array_add (data, stats);