aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-avatar.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-09-27 15:25:59 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-09-27 15:25:59 +0800
commit01e74b6239a9822b19e82c2300701987bc429fe4 (patch)
tree3b3a9b8251043f1da46befaa4eeb0d99f78ffdb0 /libempathy/empathy-avatar.c
parentfa23b38994a2feaf90c771f10f9f56d219ddab8b (diff)
downloadgsoc2013-empathy-01e74b6239a9822b19e82c2300701987bc429fe4.tar
gsoc2013-empathy-01e74b6239a9822b19e82c2300701987bc429fe4.tar.gz
gsoc2013-empathy-01e74b6239a9822b19e82c2300701987bc429fe4.tar.bz2
gsoc2013-empathy-01e74b6239a9822b19e82c2300701987bc429fe4.tar.lz
gsoc2013-empathy-01e74b6239a9822b19e82c2300701987bc429fe4.tar.xz
gsoc2013-empathy-01e74b6239a9822b19e82c2300701987bc429fe4.tar.zst
gsoc2013-empathy-01e74b6239a9822b19e82c2300701987bc429fe4.zip
Fix leak when loading avatar from cache. Do not request avatar for unknown
2007-09-27 Xavier Claessens <xclaesse@gmail.com> * libempathy/empathy-avatar.c: Fix leak when loading avatar from cache. * libempathy/empathy-contact-factory.c: Do not request avatar for unknown tokens, wait for AvatarUpdate signal. svn path=/trunk/; revision=323
Diffstat (limited to 'libempathy/empathy-avatar.c')
-rw-r--r--libempathy/empathy-avatar.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/libempathy/empathy-avatar.c b/libempathy/empathy-avatar.c
index e08dd28c4..fe4e613c6 100644
--- a/libempathy/empathy-avatar.c
+++ b/libempathy/empathy-avatar.c
@@ -67,18 +67,18 @@ avatar_get_filename (const gchar *token)
}
static EmpathyAvatar *
-avatar_new (const guchar *data,
- const gsize len,
- const gchar *format,
- const gchar *token)
+avatar_new (guchar *data,
+ gsize len,
+ gchar *format,
+ gchar *token)
{
EmpathyAvatar *avatar;
avatar = g_slice_new0 (EmpathyAvatar);
- avatar->data = g_memdup (data, len);
+ avatar->data = data;
avatar->len = len;
- avatar->format = g_strdup (format);
- avatar->token = g_strdup (token);
+ avatar->format = format;
+ avatar->token = token;
avatar->refcount = 1;
return avatar;
@@ -99,7 +99,10 @@ empathy_avatar_new (const guchar *data,
g_return_val_if_fail (format != NULL, NULL);
g_return_val_if_fail (!G_STR_EMPTY (token), NULL);
- avatar = avatar_new (data, len, format, token);
+ avatar = avatar_new (g_memdup (data, len),
+ len,
+ g_strdup (format),
+ g_strdup (token));
/* Save to cache if not yet in it */
filename = avatar_get_filename (token);
@@ -142,7 +145,7 @@ empathy_avatar_new_from_cache (const gchar *token)
if (data) {
empathy_debug (DEBUG_DOMAIN, "Avatar loaded from %s", filename);
- avatar = avatar_new (data, len, NULL, token);
+ avatar = avatar_new (data, len, NULL, g_strdup (token));
}
g_free (filename);