mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
LibC VFS: Warn on possible FD path leaks
This commit is contained in:
parent
222a789fef
commit
06e605defa
@ -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);
|
||||
|
@ -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) { }
|
||||
|
Loading…
Reference in New Issue
Block a user