diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-02 00:52:23 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-02 00:52:37 +0100 |
commit | c3804ab00e95b6b9e330275cb4ff1c10f8af5531 (patch) | |
tree | e8ac77a39a376bc1d6dada6f8c543057daa58a13 /libnetfs | |
parent | c458a7f5aeaf9f5ce0c72d97b21e0eec2b9b145a (diff) | |
download | hurd-c3804ab00e95b6b9e330275cb4ff1c10f8af5531.tar.gz hurd-c3804ab00e95b6b9e330275cb4ff1c10f8af5531.tar.bz2 hurd-c3804ab00e95b6b9e330275cb4ff1c10f8af5531.zip |
fsys_get_children: Fix memleak on error
Diffstat (limited to 'libnetfs')
-rw-r--r-- | libnetfs/fsys-get-children.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libnetfs/fsys-get-children.c b/libnetfs/fsys-get-children.c index 6a038d23..4e78a8ca 100644 --- a/libnetfs/fsys-get-children.c +++ b/libnetfs/fsys-get-children.c @@ -40,7 +40,7 @@ netfs_S_fsys_get_children (struct netfs_control *fsys, mach_msg_type_number_t *controlsCnt) { error_t err; - char *n = NULL; + char *n = NULL, *orig_names = *names; size_t n_len = 0; mach_port_t *c; size_t c_count; @@ -62,7 +62,11 @@ netfs_S_fsys_get_children (struct netfs_control *fsys, (char **) controls, controlsCnt); c = NULL; /* c was freed by iohelp_return_malloced_buffer. */ if (err) - goto errout; + { + if (*names != *orig_names) + munmap (*names, n_len); + goto errout; + } *controlsPoly = MACH_MSG_TYPE_MOVE_SEND; *controlsCnt = c_count; |