Patch from Gaul to plug a small leak, with an additional fix to free

Thu, 17 Apr 2008 16:59:31 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Thu, 17 Apr 2008 16:59:31 +0000
changeset 22810
ede0b51be7c3
parent 22809
c2b010c50376
child 22827
a73408f0d27b

Patch from Gaul to plug a small leak, with an additional fix to free
another returned value from gtk_imhtml_get_html_opt. Closes #5536.

pidgin/gtkimhtml.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkimhtml.c	Mon Apr 14 05:30:18 2008 +0000
+++ b/pidgin/gtkimhtml.c	Thu Apr 17 16:59:31 2008 +0000
@@ -2697,8 +2697,11 @@
 
 						if (sml)
 							font->sml = sml;
-						else if (oldfont && oldfont->sml)
-							font->sml = g_strdup(oldfont->sml);
+						else {
+							g_free(sml);
+							if (oldfont && oldfont->sml)
+								font->sml = g_strdup(oldfont->sml);
+						}
 
 						if (size && !(options & GTK_IMHTML_NO_SIZES) && (imhtml->format_functions & (GTK_IMHTML_GROW|GTK_IMHTML_SHRINK))) {
 							if (*size == '+') {
@@ -2750,7 +2753,7 @@
 				case 46:	/* IMG (opt) */
 				case 59:	/* IMG */
 					{
-						const char *id;
+						char *id;
 
 						gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos);
 						ws[0] = '\0'; wpos = 0;
@@ -2762,6 +2765,7 @@
 						if (!id)
 							break;
 						gtk_imhtml_insert_image_at_iter(imhtml, atoi(id), iter);
+						g_free(id);
 						break;
 					}
 				case 47:	/* P (opt) */

mercurial