[libsocialweb] Fix memory leak when API key or secret is zero character length.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsocialweb] Fix memory leak when API key or secret is zero character length.
- Date: Tue, 12 Apr 2011 07:44:28 +0000 (UTC)
commit ab35fcf186386dc2e5fdf768c0de7fb8b565afb4
Author: Stef Walter <stefw collabora co uk>
Date: Thu Apr 7 15:08:26 2011 +0200
Fix memory leak when API key or secret is zero character length.
https://bugs.meego.com/show_bug.cgi?id=15559
libsocialweb-keystore/sw-keystore.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/libsocialweb-keystore/sw-keystore.c b/libsocialweb-keystore/sw-keystore.c
index 1be0af2..7046a01 100644
--- a/libsocialweb-keystore/sw-keystore.c
+++ b/libsocialweb-keystore/sw-keystore.c
@@ -104,15 +104,19 @@ load_keys_from_dir (GHashTable *hash, const char *base_dir, gboolean is_base)
data->key = g_data_input_stream_read_line (dstream, NULL, NULL, NULL);
if (data->key) {
g_strstrip (data->key);
- if (data->key[0] == '\0')
+ if (data->key[0] == '\0') {
+ free (data->key);
data->key = NULL;
+ }
}
data->secret = g_data_input_stream_read_line (dstream, NULL, NULL, NULL);
if (data->secret) {
g_strstrip (data->secret);
- if (data->secret[0] == '\0')
- data->secret = NULL;
+ if (data->secret[0] == '\0') {
+ free (data->secret);
+ data->secret = NULL;
+ }
}
g_hash_table_insert (hash, g_strdup (name), data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]