From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7EDA4138200 for ; Wed, 5 Sep 2012 23:46:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 99B1AE0724; Wed, 5 Sep 2012 23:46:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 628D0E0724 for ; Wed, 5 Sep 2012 23:46:08 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B02BA33D779 for ; Wed, 5 Sep 2012 23:46:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 193C3E5443 for ; Wed, 5 Sep 2012 23:46:06 +0000 (UTC) From: "Alexandre Restovtsev" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alexandre Restovtsev" Message-ID: <1346888742.51b24876f8d7af6b4a292bc43266d2012dde3cae.tetromino@gentoo> Subject: [gentoo-commits] proj/openrc-settingsd:master commit in: src/ X-VCS-Repository: proj/openrc-settingsd X-VCS-Files: src/localed.c src/timedated.c X-VCS-Directories: src/ X-VCS-Committer: tetromino X-VCS-Committer-Name: Alexandre Restovtsev X-VCS-Revision: 51b24876f8d7af6b4a292bc43266d2012dde3cae X-VCS-Branch: master Date: Wed, 5 Sep 2012 23:46:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: eb0f0a15-9c51-4016-b881-ca01b2da4796 X-Archives-Hash: 5e21ed16eeedf382a0bd0a045d8c7c2a commit: 51b24876f8d7af6b4a292bc43266d2012dde3cae Author: Alexandre Rostovtsev gentoo org> AuthorDate: Wed Sep 5 23:45:42 2012 +0000 Commit: Alexandre Restovtsev gmail com> CommitDate: Wed Sep 5 23:45:42 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc-settingsd.git;a=commit;h=51b24876 Fix memory leaks --- src/localed.c | 9 +++++++-- src/timedated.c | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/localed.c b/src/localed.c index 0cb4404..5eb3f65 100644 --- a/src/localed.c +++ b/src/localed.c @@ -620,6 +620,7 @@ xorg_confd_parser_line_set_or_delete (GList *line, next->prev = prev; return prev; } + g_free (entry->value); entry->value = g_strdup (value); replacement = g_strdup_printf ("\\1\"%s\"", value); replaced = g_regex_replace (re, entry->string, -1, 0, replacement, 0, NULL); @@ -871,7 +872,10 @@ on_handle_set_locale_authorized_cb (GObject *source_object, out: shell_parser_free (locale_file_parsed); - g_strfreev (locale_values); + /* g_strfreev (locale_values) will leak, since it stops at first NULL value */ + for (val = locale_values, var = locale_variables; *var != NULL; val++, var++) + g_free (*val); + g_free (locale_values); invoked_locale_free (data); if (err != NULL) g_error_free (err); @@ -1281,11 +1285,12 @@ localed_init (gboolean _read_only) for (variable = locale_variables, value = locale_values; *variable != NULL; variable++, value++) { if (*value != NULL) { *loc = g_strdup_printf ("%s=%s", *variable, *value); + g_free (*value); loc++; } } - g_strfreev (locale_values); + g_free (locale_values); } if (err != NULL) { g_debug ("%s", err->message); diff --git a/src/timedated.c b/src/timedated.c index d6588f4..32e9171 100644 --- a/src/timedated.c +++ b/src/timedated.c @@ -63,6 +63,7 @@ get_local_rtc (GError **error) clock = shell_source_var (hwclock_file, "${clock}", error); if (!g_strcmp0 (clock, "local")) ret = TRUE; + g_free (clock); return ret; }