diff options
| author | Mark Wielaard <[email protected]> | 2021-04-03 19:52:38 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2021-04-13 14:45:34 +0200 |
| commit | 879513aba0b765c5552fc371c7fc55df4135661e (patch) | |
| tree | d5066b003bd6d1d21738c1f74a9c7e2faefb844d /src | |
| parent | 1261691accb3f224ebbaef438a641273c4c3c49f (diff) | |
nm: Fix file descriptor leak on dwfl_begin failure.
If dwfl_begin fails we won't use the dwfl_fd descriptor we just dupped.
Make sure to close on dwfl_begin failure to avoid the leak.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/nm.c | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 300deb4f..0cea28e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2021-04-03 Mark Wielaard <[email protected]> + * nm.c (show_symbols): close dwfl_fd if dwfl_begin fails. + +2021-04-03 Mark Wielaard <[email protected]> + * unstrip.c (handle_output_dir_module): Free output_file when done. 2021-04-03 Mark Wielaard <[email protected]> @@ -1308,6 +1308,8 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr, dwfl_getmodules (dwfl, &getdbg_dwflmod, &get, 0); } } + else + close (dwfl_fd); } } if (dbg != NULL) |
