[gtksourceview] Do not leak color strings when building CSS
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Do not leak color strings when building CSS
- Date: Sat, 29 Jan 2011 15:16:06 +0000 (UTC)
commit 6fd28835e8b6592340ffcca3a547613ddf277b98
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Jan 29 16:17:32 2011 +0100
Do not leak color strings when building CSS
gtksourceview/gtksourcestylescheme.c | 25 ++++++-------------------
1 files changed, 6 insertions(+), 19 deletions(-)
---
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 03b5427..9dc0d32 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -624,38 +624,25 @@ get_css_color_style (GtkSourceStyle *style,
gchar **text)
{
GdkRGBA color;
- gchar *bg_color, *text_color;
if (get_color (style, FALSE, &color))
{
+ gchar *bg_color;
bg_color = gdk_rgba_to_string (&color);
- }
- else
- {
- bg_color = NULL;
- }
-
- if (get_color (style, TRUE, &color))
- {
- text_color = gdk_rgba_to_string (&color);
- }
- else
- {
- text_color = NULL;
- }
-
- if (bg_color)
- {
*bg = g_strdup_printf ("%s: %s;\n", "background-color", bg_color);
+ g_free (bg_color);
}
else
{
*bg = NULL;
}
- if (text_color)
+ if (get_color (style, TRUE, &color))
{
+ gchar *text_color;
+ text_color = gdk_rgba_to_string (&color);
*text = g_strdup_printf ("%s: %s;\n", "color", text_color);
+ g_free (text_color);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]