[gtksourceview] Avoid minor memory leak in gtk_source_undo_action_free()



commit 5735a7f7bdbe403cca6ab573fdca68b754a0d450
Author: Morshed Nader <morshed nader gmail com>
Date:   Sat Mar 30 12:54:36 2013 +0100

    Avoid minor memory leak in gtk_source_undo_action_free()
    
    Anyway the g_return_if_reached() should never happen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=638695

 gtksourceview/gtksourceundomanagerdefault.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourceundomanagerdefault.c b/gtksourceview/gtksourceundomanagerdefault.c
index af3df98..698e57b 100644
--- a/gtksourceview/gtksourceundomanagerdefault.c
+++ b/gtksourceview/gtksourceundomanagerdefault.c
@@ -785,14 +785,23 @@ static void
 gtk_source_undo_action_free (GtkSourceUndoAction *action)
 {
        if (action == NULL)
+       {
                return;
+       }
 
        if (action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT)
+       {
                g_free (action->action.insert.text);
+       }
        else if (action->action_type == GTK_SOURCE_UNDO_ACTION_DELETE)
+       {
                g_free (action->action.delete.text);
+       }
        else
+       {
+               g_free (action);
                g_return_if_reached ();
+       }
 
        g_free (action);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]