changeset 28904:a25090259b4c

Free allocated string from text-buffer.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 23 Jan 2010 06:20:54 +0000
parents 03705a4f3dc0
children d69df70937cc
files pidgin/gtkrequest.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkrequest.c	Sat Jan 23 03:56:35 2010 +0000
+++ b/pidgin/gtkrequest.c	Sat Jan 23 06:20:54 2010 +0000
@@ -719,24 +719,26 @@
 {
 	PurpleRequestFieldGroup *group;
 	PidginRequestData *req_data;
-	const char *text = NULL;
 
 	if (purple_request_field_string_is_multiline(field))
 	{
+		char *text;
 		GtkTextIter start_iter, end_iter;
 
 		gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(entry), &start_iter);
 		gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(entry), &end_iter);
 
 		text = gtk_text_buffer_get_text(GTK_TEXT_BUFFER(entry), &start_iter, &end_iter, FALSE);
+		purple_request_field_string_set_value(field, (!text || !*text) ? NULL : text);
+		g_free(text);
 	}
 	else
 	{
+		const char *text = NULL;
 		text = gtk_entry_get_text(GTK_ENTRY(entry));
+		purple_request_field_string_set_value(field, (*text == '\0') ? NULL : text);
 	}
 
-	purple_request_field_string_set_value(field, (*text == '\0') ? NULL : text);
-
 	group = purple_request_field_get_group(field);
 	req_data = (PidginRequestData *)group->fields_list->ui_data;