[PATCH v5 0/1] MR1774: urlmon: Pass correct parameter to realloc (Coverity)
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> -- v5: urlmon: Pass correct parameter to realloc and simplify code (Coverity) https://gitlab.winehq.org/wine/wine/-/merge_requests/1774
From: Fabian Maurer <dark.shadow4(a)web.de> Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> --- dlls/urlmon/sec_mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index e6d1864b1e7..ad22b1596e4 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -1276,13 +1276,13 @@ static LPDWORD build_zonemap_from_reg(void) if (used == allocated) { LPDWORD new_data; + allocated *= 2; new_data = realloc(data, allocated * sizeof(DWORD)); if (!new_data) goto cleanup; - memset(new_data + allocated, 0, allocated * sizeof(DWORD)); data = new_data; - allocated *= 2; + } data[used] = wcstol(name, NULL, 10); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1774
Alex Henrie (@alexhenrie) commented about dlls/urlmon/sec_mgr.c:
if (used == allocated) { LPDWORD new_data;
+ allocated *= 2; new_data = realloc(data, allocated * sizeof(DWORD)); if (!new_data) goto cleanup; - memset(new_data + allocated, 0, allocated * sizeof(DWORD));
data = new_data; - allocated *= 2; +
Please just delete the line. It looks weird to have a blank line before a closing brace. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1774#note_19708
participants (3)
-
Alex Henrie (@alexhenrie) -
Fabian Maurer -
Fabian Maurer (@DarkShadow44)