changeset 28099:080cfd84038c

Don't leak the GError from g_convert.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 31 Jul 2009 04:42:52 +0000
parents 0e49276d9ba1
children f834ffa7490b b131c68822ce
files libpurple/protocols/msn/slpcall.c
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slpcall.c	Fri Jul 31 04:21:30 2009 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri Jul 31 04:42:52 2009 +0000
@@ -217,10 +217,12 @@
 			 || body_len <= 0
 			 || strstr(body_str, "image/gif") == NULL)
 			{
-				if (error != NULL)
+				if (error != NULL) {
 					purple_debug_error("msn",
 					                   "Unable to convert Ink header from UTF-16 to UTF-8: %s\n",
 					                   error->message);
+					g_error_free(error);
+				}
 				else
 					purple_debug_error("msn",
 					                   "Received Ink in unknown format\n");
@@ -234,9 +236,15 @@
 			                     &bytes_read, &bytes_written, &error);
 			if (!body_str)
 			{
-				purple_debug_error("msn",
-				                   "Unable to convert Ink body from UTF-16 to UTF-8: %s\n",
-				                   error->message);
+				if (error != NULL) {
+					purple_debug_error("msn",
+					                   "Unable to convert Ink body from UTF-16 to UTF-8: %s\n",
+					                   error->message);
+					g_error_free(error);
+				}
+				else
+					purple_debug_error("msn",
+					                   "Received Ink in unknown format\n");
 				return NULL;
 			}