LibC VFS: Warn on possible FD path leaks

This commit is contained in:
Martin Stein 2017-02-16 19:02:19 +01:00 committed by Christian Helmuth
parent 222a789fef
commit 06e605defa
2 changed files with 2 additions and 0 deletions

View File

@ -49,6 +49,7 @@ namespace Libc {
void path(char const *newpath)
{
if (fd_path) { Genode::warning("may leak former FD path memory"); }
if (newpath) {
Genode::size_t const path_size = ::strlen(newpath) + 1;
char *buf = (char*)malloc(path_size);

View File

@ -66,6 +66,7 @@ class Libc::Vfs_plugin : public Libc::Plugin
* We have to allocate the path from the libc (done via 'strdup')
* such that the path can be freed when an stdio fd is closed.
*/
if (fd->fd_path) { Genode::warning("may leak former FD path memory"); }
fd->fd_path = strdup(path.string());
} catch (Xml_node::Nonexistent_attribute) { }