changeset 22375:f332db29a854

Fixes a memleak: ==17163== 7 bytes in 1 blocks are definitely lost in loss record 7 of 214 ==17163== at 0x4006A6E: malloc (vg_replace_malloc.c:207) ==17163== by 0xA1CAF5: g_malloc (in /lib/libglib-2.0.so.0.1400.6) ==17163== by 0xA35348: g_strdup (in /lib/libglib-2.0.so.0.1400.6) ==17163== by 0xA35BF9: g_strsplit (in /lib/libglib-2.0.so.0.1400.6) ==17163== by 0x52D5DF2: irc_cmd_op (cmds.c:290) committer: Ka-Hing Cheung <khc@hxbc.us>
author Andrew Gaul <andrew@gaul.org>
date Fri, 29 Feb 2008 07:55:20 +0000
parents 2e5ba07ed81a
children 177d5a1f12a6
files libpurple/protocols/irc/cmds.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/irc/cmds.c	Fri Feb 29 04:31:07 2008 +0000
+++ b/libpurple/protocols/irc/cmds.c	Fri Feb 29 07:55:20 2008 +0000
@@ -294,17 +294,15 @@
 	ops = g_new0(char *, i * 2 + 1);
 
 	for (i = 0; nicks[i]; i++) {
-		if (!*nicks[i]) {
-			g_free(nicks[i]);
-			continue;
+		if (*nicks[i]) {
+			ops[used++] = mode;
+			ops[used++] = nicks[i];
 		}
-		ops[used++] = mode;
-		ops[used++] = nicks[i];
 	}
 
 	irc_do_mode(irc, target, sign, ops);
 	g_free(ops);
-	g_free(nicks);  /* No, not g_strfreev */
+	g_strfreev(nicks);
 
 	return 0;
 }