changeset 27123:3ea4e638ce81

Yikes. buf is on the stack and shouldn't be freed. This fixes a crash.
author Mark Doliner <mark@kingant.net>
date Fri, 19 Jun 2009 01:28:46 +0000
parents d06f9250cf5a
children 94fa9e38f366
files libpurple/protocols/yahoo/yahoo.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Fri Jun 19 00:06:49 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Jun 19 01:28:46 2009 +0000
@@ -2311,13 +2311,11 @@
 		purple_debug_warning("yahoo","p2p: Got something other than YMSG packet\n");
 
 		start = memchr(buf + 1, 'Y', len - 1);
-		if(start) {
-			g_memmove(buf, start, len - (start - buf));
-			len -= start - buf;
-		} else {
-			g_free(buf);
+		if (start == NULL)
 			return;
-		}
+
+		g_memmove(buf, start, len - (start - buf));
+		len -= start - buf;
 	}
 
 	pos += 4;	/* YMSG */