code: drawterm

Download patch

ref: a85fefcc920f837ce3a8e0010cfd09cf0b3523ce
parent: bf7b4c49fb935ada8ce6918c5a96bea2f95de041
author: Russ Cox <rsc@swtch.com>
date: Sun Nov 12 22:23:32 EST 2006

sync with Plan 9

--- a/kern/devmnt.c
+++ b/kern/devmnt.c
@@ -196,7 +196,8 @@
 		error("server tries to increase msize in fversion");
 	if(f.msize<256 || f.msize>1024*1024)
 		error("nonsense value of msize in fversion");
-	if(strncmp(f.version, v, strlen(f.version)) != 0)
+	k = strlen(f.version);
+	if(strncmp(f.version, v, k) != 0)
 		error("bad 9P version returned from server");
 
 	/* now build Mnt associated with this connection */
@@ -220,7 +221,6 @@
 	m->msize = f.msize;
 	unlock(&mntalloc.lk);
 
-	k = strlen(f.version);
 	if(returnlen > 0){
 		if(returnlen < k)
 			error(Eshort);
@@ -242,7 +242,6 @@
 	poperror();	/* c */
 	qunlock(&c->umqlock);
 
-	free(msg);
 	return k;
 }