summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Scarapicchia Junior <pedrinho.rep51@gmail.com>2011-05-09 16:10:49 +0200
committerEric Van Hensbergen <ericvh@gmail.com>2011-05-13 00:05:37 +0200
commit1b0bcbcf62884959fa7214eb16c44cff445691c6 (patch)
tree08d74d89ce863caec1536c3830168ed7a2d42817
parentMerge branch 'fix/asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwa... (diff)
downloadlinux-1b0bcbcf62884959fa7214eb16c44cff445691c6.tar.xz
linux-1b0bcbcf62884959fa7214eb16c44cff445691c6.zip
net/9p/protocol.c: Fix a memory leak
When p9pdu_readf() is called with "s" attribute, it allocates a pointer that will store a string. In p9dirent_read(), this pointer is not being released, leading to out of memory errors. This patch releases this pointer after string is copyed to dirent->d_name. Signed-off-by: Pedro Scarapicchia Junior <pedro.scarapiccha@br.flextronics.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
-rw-r--r--net/9p/protocol.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index b58a501cf3d1..a873277cb996 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -674,6 +674,7 @@ int p9dirent_read(char *buf, int len, struct p9_dirent *dirent,
}
strcpy(dirent->d_name, nameptr);
+ kfree(nameptr);
out:
return fake_pdu.offset;