=?utf-8?q?=5Bfolks=5D_core=3A_Don=E2=80=99t_leak_file_contents_when_loadi?= =?utf-8?q?ng_key-files?=
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Donât leak file contents when loading key-files
- Date: Sat, 21 Apr 2012 23:36:20 +0000 (UTC)
commit 52e9ad1883ee9137a87cf50c9896fba2a0ea9ffa
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Apr 22 00:35:00 2012 +0100
core: Donât leak file contents when loading key-files
Valaâs â*â operator requires explicit memory management. Itâs better that
we avoid using it at all.
backends/key-file/kf-persona-store.vala | 4 ++--
folks/backend-store.vala | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala
index 45234d0..f440b9f 100644
--- a/backends/key-file/kf-persona-store.vala
+++ b/backends/key-file/kf-persona-store.vala
@@ -200,11 +200,11 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
* below and try to create it instead. */
try
{
- uint8 *contents = null;
+ uint8[] contents;
yield this.file.load_contents_async (null, out contents,
null);
- var contents_s = (string) contents;
+ unowned string contents_s = (string) contents;
if (contents_s.length > 0)
{
diff --git a/folks/backend-store.vala b/folks/backend-store.vala
index 554c316..6866eee 100644
--- a/folks/backend-store.vala
+++ b/folks/backend-store.vala
@@ -729,10 +729,10 @@ public class Folks.BackendStore : Object {
this._backends_key_file = new GLib.KeyFile ();
try
{
- uint8 *contents = null;
+ uint8[] contents;
yield file.load_contents_async (null, out contents, null);
- var contents_s = (string) contents;
+ unowned string contents_s = (string) contents;
if (contents_s.length > 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]