提交 1b0bcbcf 编写于 作者: P Pedro Scarapicchia Junior 提交者: Eric Van Hensbergen

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: NPedro Scarapicchia Junior <pedro.scarapiccha@br.flextronics.com>
Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>
上级 ca1376d1
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册