[PATCH v3 0/2] MR1774: Coverity fixes
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> -- v3: wldap32: Free resource in error case (Coverity) urlmon: Pass correct parameter to realloc (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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index e6d1864b1e7..0d81e4dfda9 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -1276,7 +1276,7 @@ static LPDWORD build_zonemap_from_reg(void) if (used == allocated) { LPDWORD new_data; - new_data = realloc(data, allocated * sizeof(DWORD)); + new_data = realloc(data, allocated * 2 * sizeof(DWORD)); if (!new_data) goto cleanup; memset(new_data + allocated, 0, allocated * sizeof(DWORD)); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1774
From: Fabian Maurer <dark.shadow4(a)web.de> --- dlls/wldap32/misc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/wldap32/misc.c b/dlls/wldap32/misc.c index edf1f196353..9db98cc9e46 100644 --- a/dlls/wldap32/misc.c +++ b/dlls/wldap32/misc.c @@ -413,10 +413,15 @@ ULONG CDECL WLDAP32_ldap_result( LDAP *ld, ULONG msgid, ULONG all, struct l_time ret = ldap_result( CTX(ld), msgid, all, timeout ? &timeval : NULL, &msgU ); } - if (msgU && (msg = calloc( 1, sizeof(*msg) ))) + if (msgU) { - MSG(msg) = msgU; - *res = msg; + if ((msg = calloc( 1, sizeof(*msg) ))) + { + MSG(msg) = msgU; + *res = msg; + } + else + free( msgU ); } return ret; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1774
On Mon Dec 12 15:09:30 2022 +0000, Fabian Maurer wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/1774/diffs?diff_id=24527&start_sha=9d3e26a40e98902f01c6c507d123f0c4ac5294ff#b8426569d6929c4045aaa277677c75ee4b397edb_424_424) I would prefer to see all these cases fixed as suggested by Alex. It would also be nice if you could put the wldap32 changes in a separate MR.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1774#note_19478
participants (3)
-
Fabian Maurer -
Fabian Maurer (@DarkShadow44) -
Hans Leidekker (@hans)