GNOME Bugzilla – Bug 638695
Small potential memory leak in gtk_source_undo_action_free()
Last modified: 2013-03-30 11:58:15 UTC
In gtk_source_undo_action_free, there's the small potential to leak memory if the action->action_type is not recognized. I've attached a patch with the fix
Created attachment 177514 [details] [review] Patch to gtksourceviewundomanagerdefault.c
Please can you attach a git format-patch to give you the credit or at least a diff with the universal format? diff -u, or git diff.
Comment on attachment 177514 [details] [review] Patch to gtksourceviewundomanagerdefault.c diff --git a/gtksourceview/gtksourceundomanagerdefault.c b/gtksourceview/gtksourceundomanagerdefault.c index 97bf632..8c988eb 100644 --- a/gtksourceview/gtksourceundomanagerdefault.c +++ b/gtksourceview/gtksourceundomanagerdefault.c @@ -791,8 +791,10 @@ gtk_source_undo_action_free (GtkSourceUndoAction *action) g_free (action->action.insert.text); else if (action->action_type == GTK_SOURCE_UNDO_ACTION_DELETE) g_free (action->action.delete.text); - else + else { + g_free (action); g_return_if_reached (); + } g_free (action); }
Created attachment 177619 [details] [review] Updated patch using git diff
Fixed: https://git.gnome.org/browse/gtksourceview/commit/?id=5735a7f7bdbe403cca6ab573fdca68b754a0d450 Thanks for your bug report and your patch.