Commit 18ae8d6
dir.c: fix dirent leak on glob_opendir realloc failure
In glob_opendir(), each directory entry is copied before the entries
array is grown. If growing ent->sort.entries fails, the function jumps
to the nomem label before the copied entry is stored in the array.
glob_dir_finish() only frees entries already recorded in
ent->sort.entries, so the current rdp is leaked on that error path.
Free rdp before jumping to nomem.
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>1 parent 4ed7fa5 commit 18ae8d6
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2803 | 2803 | | |
2804 | 2804 | | |
2805 | 2805 | | |
2806 | | - | |
| 2806 | + | |
| 2807 | + | |
2807 | 2808 | | |
| 2809 | + | |
2808 | 2810 | | |
2809 | 2811 | | |
2810 | 2812 | | |
| |||
0 commit comments