changeset 6051:a170c50b2a48

[gaim-migrate @ 6501] This should fix a somewhat rare ICQ crash. http://sourceforge.net/tracker/index.php?func=detail&aid=749156&group_id=235&atid=100235 committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 07 Jul 2003 02:59:13 +0000
parents 72403c3c84e1
children c062c4bf58ac
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Sun Jul 06 23:33:24 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Jul 07 02:59:13 2003 +0000
@@ -2535,7 +2535,7 @@
 	GaimConnection *gc = sess->aux_data;
 	gchar **msg1, **msg2;
 	GError *err = NULL;
-	int i;
+	int i, numtoks;
 
 	if (!args->type || !args->msg || !args->uin)
 		return 1;
@@ -2545,7 +2545,8 @@
 
 	/* Split up the message at the delimeter character, then convert each string to UTF-8 */
 	msg1 = g_strsplit(args->msg, "\376", 0);
-	msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */
+	for (numtoks=0; msg1[numtoks]; numtoks++);
+	msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *));
 	for (i=0; msg1[i]; i++) {
 		strip_linefeed(msg1[i]);
 		msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err);