mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +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)
|
void path(char const *newpath)
|
||||||
{
|
{
|
||||||
|
if (fd_path) { Genode::warning("may leak former FD path memory"); }
|
||||||
if (newpath) {
|
if (newpath) {
|
||||||
Genode::size_t const path_size = ::strlen(newpath) + 1;
|
Genode::size_t const path_size = ::strlen(newpath) + 1;
|
||||||
char *buf = (char*)malloc(path_size);
|
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')
|
* 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.
|
* 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());
|
fd->fd_path = strdup(path.string());
|
||||||
|
|
||||||
} catch (Xml_node::Nonexistent_attribute) { }
|
} catch (Xml_node::Nonexistent_attribute) { }
|
||||||
|
Loading…
Reference in New Issue
Block a user