g_free (new_format_name);
- /* Takes ownership of new_mime_type and best_image_data */
avatar = empathy_avatar_new ((guchar *) best_image_data,
best_image_size, new_mime_type, NULL);
+ g_free (best_image_data);
+ g_free (new_mime_type);
+
return avatar;
}
g_object_unref (pixbuf);
}
+/* takes ownership of @data */
static void
avatar_chooser_set_image_from_data (EmpathyAvatarChooser *self,
gchar *data,
return;
}
- /* avatar takes ownership of data and mime_type */
avatar = empathy_avatar_new ((guchar *) data, size, mime_type, NULL);
avatar_chooser_set_image (self, avatar, pixbuf, set_locally);
+
+ g_free (mime_type);
+ g_free (data);
}
static void
if (handled)
{
- /* this in turn calls empathy_avatar_new (), which assumes
- * ownership of data.
- */
- avatar_chooser_set_image_from_data (self, data,
- bytes_read,
- TRUE);
+ /* pass data to the avatar_chooser_set_image_from_data */
+ avatar_chooser_set_image_from_data (self, data, bytes_read, TRUE);
}
g_object_unref (file);
return;
}
+ /* pass image_data to the avatar_chooser_set_image_from_data */
avatar_chooser_set_image_from_data (self, image_data, image_size, TRUE);
}
avatar_chooser_set_avatar_from_pixbuf (EmpathyAvatarChooser *self,
GdkPixbuf *pb)
{
- /* dup the string as empathy_avatar_new steals ownership of the it */
- gchar *mime = g_strdup ("image/png");
gsize size;
gchar *buf;
EmpathyAvatar *avatar = NULL;
return;
}
- avatar = empathy_avatar_new ((guchar *) buf, size, mime, NULL);
+ avatar = empathy_avatar_new ((guchar *) buf, size, "image/png", NULL);
avatar_chooser_set_image (self, avatar, pb, TRUE);
+
+ g_free (buf);
}
static gboolean