[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] [patch] Use peername after free'd



Attached is a patch that fixes a problem that peername is used after calling free. This is certainly bad, and causes problems in systems that use %s as the filename/connection mapping. It seems to be that no connections should work w/o this fix, not sure how no one else has encountered this.

This problem seems to have been in the 2.9.x releases (certainly 2.9.2 & 2.9.3)



Index: nbd-server.c
===================================================================
--- nbd-server.c	(revision 259)
+++ nbd-server.c	(working copy)
@@ -1342,10 +1342,10 @@
 			break;
 	}
 
-	g_free(peername);
 	msg4(LOG_INFO, "connect from %s, assigned file is %s", 
 	     peername, client->exportname);
 	client->clientname=g_strdup(peername);
+	g_free(peername);
 }
 
 /**

Reply to: