Skip to contentSkip to conversation

v9fs: Twalk memory leak

PATCH New Latchesar Ionkov 1 participant 1 message May 6, 2006 9P file system

lore
Share & tools
lore

Latchesar Ionkov

author maintainer
#0 lore raw

PATCH 1/1 v9fs: Twalk memory leak

v9fs leaks memory if the file server responds with Rerror to a Twalk message. The patch fixes the leak.

---
commit d0ea523deb849227892c3359227219a260390dec
tree da70110e3a0691dd0a30d037b6456b9372c20f51
parent ebf34c9b6fcd22338ef764b039b3ac55ed0e297b
author Latchesar Ionkov <[email protected]> Tue, 02 May 2006 16:42:24 -0600 committer Latchesar Ionkov <[email protected]> Tue, 02 May 2006 16:42:24 -0600

 fs/9p/fcall.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)
fs/9p/fcall.c +9 -12
index 71742ba..6f26178 100644
@@ -98,23 +98,20 @@ v9fs_t_attach(struct v9fs_session_info *
 static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
 	struct v9fs_fcall *rc, int err)
 {
-	int fid;
+	int fid, id;
 	struct v9fs_session_info *v9ses;
 
-	if (err)
-		return;
-
+	id = 0;
 	fid = tc->params.tclunk.fid;
-	kfree(tc);
-
-	if (!rc)
-		return;
-
-	v9ses = a;
-	if (rc->id == RCLUNK)
-		v9fs_put_idpool(fid, &v9ses->fidpool);
+	if (rc)
+		id = rc->id;
 
+	kfree(tc);
 	kfree(rc);
+	if (id == RCLUNK) {
+		v9ses = a;
+		v9fs_put_idpool(fid, &v9ses->fidpool);
+	}
 }
 
 /**