pidgin: f0a8332b: Free allocated string from text-buffer.

sadrul at pidgin.im sadrul at pidgin.im
Sat Jan 23 01:26:09 EST 2010


-----------------------------------------------------------------
Revision: f0a8332b652a3ebe81e392b4283bbda403dd0881
Ancestor: 6c35eb289b2e2af14435d1da40f4f0001afcba6e
Author: sadrul at pidgin.im
Date: 2010-01-23T06:20:54
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f0a8332b652a3ebe81e392b4283bbda403dd0881

Modified files:
        pidgin/gtkrequest.c

ChangeLog: 

Free allocated string from text-buffer.

-------------- next part --------------
============================================================
--- pidgin/gtkrequest.c	f14c8a6d483e4817e61ccc7ea53e69ff4573c71c
+++ pidgin/gtkrequest.c	44600017c9eb97a9875bf575a3af551707ad9ccb
@@ -719,24 +719,26 @@ req_entry_field_changed_cb(GtkWidget *en
 {
 	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;
 


More information about the Commits mailing list