From afd1ce1a602e6d953b3c25310e78882591db0010 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 16 Aug 2010 17:02:45 +0000 Subject: [PATCH] Fix memory leak in read_regex(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5171 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ src/build.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6548ec2c..885c86dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ thanks). * src/build.c: Fix saving non-project filetype error regex. + * src/build.c: + Fix memory leak in read_regex(). 2010-08-15 Enrico Tröger diff --git a/src/build.c b/src/build.c index 9f809f04..039f305d 100644 --- a/src/build.c +++ b/src/build.c @@ -2130,7 +2130,7 @@ static gboolean read_row(BuildDestination *dst, BuildTableData table_data, gint static gboolean read_regex(GtkWidget *regexentry, gchar **src, gchar **dst) { gboolean changed = FALSE; - gchar *reg = g_strdup(gtk_entry_get_text(GTK_ENTRY(regexentry))); + const gchar *reg = gtk_entry_get_text(GTK_ENTRY(regexentry)); if ( ( @@ -2146,7 +2146,7 @@ static gboolean read_regex(GtkWidget *regexentry, gchar **src, gchar **dst) { if (dst != NULL) { - setptr(*dst, reg); + setptr(*dst, g_strdup(reg)); changed = TRUE; } }