5 Jun
2023
5 Jun
'23
12:12 p.m.
Piotr Caban (@piotr) commented about dlls/msvcrt/dir.c:
if (dir_len < 1) return NULL; /* FIXME: Real return value untested */
- if (!buf) - { - if (size <= dir_len) size = dir_len + 1; - if (!(buf = malloc( size * sizeof(WCHAR) ))) return NULL; - } + if (!buf && size <= dir_len) + size = dir_len + 1; if (dir_len >= size) There's no leak here. In case !buf we're updating size if it's to small.
The code can be changed to: ```suggestion:-0+0 else if (dir_len >= size) ``` to make it easier to read. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2976#note_34643