diff libpurple/protocols/myspace/message.c @ 20243:5440eed4ec7e

applied changes from efedefa70ee1d6f7f4dd39afe5db10c7e5bfe64c through afa2cfc77d5df43359af0e531c44167cf94d7d06
author Richard Laager <rlaager@wiktel.com>
date Fri, 28 Sep 2007 15:57:10 +0000
parents 44b4e8bd759b
children b93e7be3847b
line wrap: on
line diff
--- a/libpurple/protocols/myspace/message.c	Fri Sep 28 15:56:31 2007 +0000
+++ b/libpurple/protocols/myspace/message.c	Fri Sep 28 15:57:10 2007 +0000
@@ -80,7 +80,7 @@
 	purple_debug_info("msim", "msim_escape: msg=%s, ret=%s\n", msg, gs->str);
 #endif
 
-	return gs->str;
+	return g_string_free(gs, FALSE);
 }
 
 /**
@@ -120,7 +120,7 @@
 	purple_debug_info("msim", "msim_unescape: msg=%s, ret=%s\n", msg, gs->str);
 #endif
 
-	return gs->str;
+	return g_string_free(gs, FALSE);
 }
 
 /** Create a new MsimMessage. 
@@ -691,7 +691,7 @@
 				++i;
 			}
 			
-			string = gs->str;
+			string = g_string_free(gs, FALSE);
 			break;
 
 		default:
@@ -798,7 +798,7 @@
 					g_string_append(gs, "|");
 			}
 			
-			return gs->str;
+			return g_string_free(gs, FALSE);
 
 		default:
 			purple_debug_info("msim", "field %s, unknown type %d\n", 
@@ -1337,9 +1337,7 @@
 			gs = (GString *)elem->data;
 
 			/* Duplicate data, so caller can g_free() it. */
-			*binary_data = g_new0(char, gs->len);
-			memcpy(*binary_data, gs->str, gs->len);
-
+			*binary_data = g_memdup(gs->str, gs->len);
 			*binary_length = gs->len;
 
 			return TRUE;