After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 638695 - Small potential memory leak in gtk_source_undo_action_free()
Small potential memory leak in gtk_source_undo_action_free()
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other All
: Normal minor
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-04 20:09 UTC by morshed.nader
Modified: 2013-03-30 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to gtksourceviewundomanagerdefault.c (68 bytes, patch)
2011-01-04 20:10 UTC, morshed.nader
none Details | Review
Updated patch using git diff (548 bytes, patch)
2011-01-05 22:20 UTC, morshed.nader
none Details | Review

Description morshed.nader 2011-01-04 20:09:00 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
Comment 1 morshed.nader 2011-01-04 20:10:01 UTC
Created attachment 177514 [details] [review]
Patch to gtksourceviewundomanagerdefault.c
Comment 2 Ignacio Casal Quinteiro (nacho) 2011-01-05 20:23:54 UTC
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 3 morshed.nader 2011-01-05 22:19:47 UTC
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);
 }
Comment 4 morshed.nader 2011-01-05 22:20:56 UTC
Created attachment 177619 [details] [review]
Updated patch using git diff
Comment 5 Sébastien Wilmet 2013-03-30 11:58:15 UTC
Fixed:

https://git.gnome.org/browse/gtksourceview/commit/?id=5735a7f7bdbe403cca6ab573fdca68b754a0d450

Thanks for your bug report and your patch.