Merge lp:~macslow/notify-osd/fix-425508 into lp:notify-osd/karmic

Proposed by Mirco Müller
Status: Merged
Merged at revision: not available
Proposed branch: lp:~macslow/notify-osd/fix-425508
Merge into: lp:notify-osd/karmic
Diff against target: 79 lines
1 file modified
src/bubble.c (+36/-23)
To merge this branch: bzr merge lp:~macslow/notify-osd/fix-425508
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Review via email: mp+13472@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Made bubble_append_message_body() avoid accidentally calling g_free() on an uninitialized pointer (text). pango_parse_markup() can leave text untouched, so later on g_free() would fail without initializing text to NULL correctly. Also made tests results more robust. This is meant to fix LP: #425508 and its duplicates...

LP: #426230
LP: #427129
LP: #429025

Revision history for this message
David Barth (dbarth) wrote :

Good catch!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/bubble.c'
--- src/bubble.c 2009-10-15 13:33:14 +0000
+++ src/bubble.c 2009-10-16 14:05:21 +0000
@@ -3635,39 +3635,52 @@
3635bubble_append_message_body (Bubble* self,3635bubble_append_message_body (Bubble* self,
3636 const gchar* append_body)3636 const gchar* append_body)
3637{3637{
3638 gboolean result;3638 gboolean result = FALSE;
3639 gchar* text;3639 gchar* text = NULL;
3640 GError* error = NULL;3640 GError* error = NULL;
3641 BubblePrivate* priv = NULL;
36413642
3642 if (!self || !IS_BUBBLE (self))3643 if (!self || !IS_BUBBLE (self) || !append_body)
3643 return;3644 return;
36443645
3645 /* filter out any HTML/markup if possible */3646 priv = GET_PRIVATE (self);
3647
3648 // filter out any HTML/markup if possible
3646 result = pango_parse_markup (append_body,3649 result = pango_parse_markup (append_body,
3647 -1,3650 -1,
3648 0, /* no accel-marker needed */3651 0, // no accel-marker needed
3649 NULL, /* no PangoAttr needed */3652 NULL, // no PangoAttr needed
3650 &text,3653 &text,
3651 NULL, /* no accel-marker-return needed */3654 NULL, // no accel-marker-return needed
3652 &error);3655 &error);
3653 if (error)3656 if (error && !result)
3654 {3657 {
3655 g_warning ("bubble_append_message_body(): Got error \"%s\"\n",3658 g_warning ("%s(): Got error \"%s\"\n",
3656 error->message);3659 G_STRFUNC,
3660 error->message);
3657 g_error_free (error);3661 g_error_free (error);
3658 error = NULL;3662 error = NULL;
3659 }3663
36603664 if (text)
3661 /* append text to current message-body */3665 g_free (text);
3662 g_string_append (GET_PRIVATE (self)->message_body, text);3666 }
36633667
3664 g_signal_emit (self, g_bubble_signals[MESSAGE_BODY_INSERTED], 0, text);3668 if (text)
36653669 {
3666 g_object_notify (3670 // append text to current message-body
3667 G_OBJECT (gtk_widget_get_accessible (GET_PRIVATE(self)->widget)), 3671 g_string_append (priv->message_body, text);
3668 "accessible-description");3672
36693673 g_signal_emit (self,
3670 g_free ((gpointer) text);3674 g_bubble_signals[MESSAGE_BODY_INSERTED],
3675 0,
3676 text);
3677
3678 g_object_notify (
3679 G_OBJECT (gtk_widget_get_accessible (priv->widget)),
3680 "accessible-description");
3681
3682 g_free (text);
3683 }
3671}3684}
36723685
3673void3686void

Subscribers

People subscribed via source and target branches

to all changes: