Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/adsldp/adsldp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c index 8039065eff3..f564bc6f6cc 100644 --- a/dlls/adsldp/adsldp.c +++ b/dlls/adsldp/adsldp.c @@ -1302,7 +1302,11 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte props = NULL; else { - if (count && !names) return E_ADS_BAD_PARAMETER; + if (count && !names) + { + heap_free(ldap_ctx); + return E_ADS_BAD_PARAMETER; + }
props = heap_alloc((count + 1) * sizeof(props[0])); if (!props)
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- programs/conhost/conhost.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 78f6e345170..3c8d165cbbe 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -100,7 +100,11 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int if (screen_buffer->font.face_len) { screen_buffer->font.face_name = malloc( screen_buffer->font.face_len * sizeof(WCHAR) ); - if (!screen_buffer->font.face_name) return NULL; + if (!screen_buffer->font.face_name) + { + free( screen_buffer ); + return NULL; + }
memcpy( screen_buffer->font.face_name, console->active->font.face_name, screen_buffer->font.face_len * sizeof(WCHAR) );
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/dbghelp/dwarf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 7472b6070e6..fc88b741a56 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1289,6 +1289,7 @@ static struct addr_range* dwarf2_get_ranges(const dwarf2_debug_info_t* di, unsig { struct attribute range; struct addr_range* ranges; + struct addr_range* new_ranges;
if (dwarf2_find_attribute(di, DW_AT_ranges, &range)) { @@ -1312,8 +1313,13 @@ static struct addr_range* dwarf2_get_ranges(const dwarf2_debug_info_t* di, unsig if (*num_ranges >= alloc) { alloc *= 2; - ranges = realloc(ranges, sizeof(struct addr_range) * alloc); - if (!ranges) return NULL; + new_ranges = realloc(ranges, sizeof(struct addr_range) * alloc); + if (!new_ranges) + { + free(ranges); + return NULL; + } + ranges = new_ranges; } ranges[*num_ranges].low = di->unit_ctx->compiland->address + low; ranges[*num_ranges].high = di->unit_ctx->compiland->address + high;
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/msi/package.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 349d7c0ffa3..93cc6210f6e 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -552,6 +552,7 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) GetWindowsDirectoryW(windir, MAX_PATH); len = lstrlenW(windir) + lstrlenW(L"Microsoft.NET\Framework\") + lstrlenW(L"v2.0.50727") + lstrlenW(L"fusion.dll") + 3; + msi_free(filename); if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL;
lstrcpyW(filename, windir);
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ole32/compositemoniker.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index a94e4734f45..05901bb52b3 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -751,7 +751,11 @@ static HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith(IMoniker *iface, IMo heap_free(components); heap_free(other_components);
- if (!prefix_len) return MK_E_NOPREFIX; + if (!prefix_len) + { + heap_free(prefix_components); + return MK_E_NOPREFIX; + }
last = prefix_components[0]; for (i = 1; i < prefix_len; ++i)
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ole32/compositemoniker.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index 05901bb52b3..c234f60f953 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -1627,6 +1627,7 @@ static HRESULT composite_get_rightmost(CompositeMonikerImpl *composite, IMoniker if (!(node = moniker_tree_get_rightmost(root))) { WARN("Couldn't get right most component.\n"); + moniker_tree_release(root); return E_FAIL; }
@@ -1663,6 +1664,7 @@ static HRESULT composite_get_leftmost(CompositeMonikerImpl *composite, IMoniker if (!(node = moniker_tree_get_leftmost(root))) { WARN("Couldn't get right most component.\n"); + moniker_tree_release(root); return E_FAIL; }
And use a single variable for the encoded or decoded URL so that free only has to be called once.
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/winhttp/url.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/winhttp/url.c b/dlls/winhttp/url.c index 0d9dfb76de6..8efd5ed0c49 100644 --- a/dlls/winhttp/url.c +++ b/dlls/winhttp/url.c @@ -172,7 +172,7 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret ) */ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc ) { - WCHAR *p, *q, *r, *url_decoded = NULL, *url_escaped = NULL; + WCHAR *p, *q, *r, *url_transformed = NULL; INTERNET_SCHEME scheme_number = 0; struct url_component scheme, username, password, hostname, path, extra; BOOL overflow = FALSE; @@ -189,25 +189,26 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
if (flags & ICU_ESCAPE) { - if ((err = escape_url( url, &len, &url_escaped ))) + if ((err = escape_url( url, &len, &url_transformed ))) { SetLastError( err ); return FALSE; } - url = url_escaped; + url = url_transformed; } else if (flags & ICU_DECODE) { - if (!(url_decoded = decode_url( url, &len ))) + if (!(url_transformed = decode_url( url, &len ))) { SetLastError( ERROR_OUTOFMEMORY ); return FALSE; } - url = url_decoded; + url = url_transformed; } if (!(p = wcschr( url, ':' ))) { SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ); + free( url_transformed ); return FALSE; } if (p - url == 4 && !wcsnicmp( url, L"http", 4 )) scheme_number = INTERNET_SCHEME_HTTP; @@ -331,8 +332,7 @@ exit: if (overflow) err = ERROR_INSUFFICIENT_BUFFER; uc->nScheme = scheme_number; } - free( url_decoded ); - free( url_escaped ); + free( url_transformed ); SetLastError( err ); return !err; }
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ws2_32/protocol.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ws2_32/protocol.c b/dlls/ws2_32/protocol.c index 867e9513ca2..56b7379cccc 100644 --- a/dlls/ws2_32/protocol.c +++ b/dlls/ws2_32/protocol.c @@ -806,7 +806,7 @@ static struct hostent *get_local_ips( char *hostname ) IP_ADAPTER_INFO *adapters = NULL, *k; struct hostent *hostlist = NULL; MIB_IPFORWARDTABLE *routes = NULL; - struct route *route_addrs = NULL; + struct route *route_addrs = NULL, *new_route_addrs; DWORD adap_size, route_size, n;
/* Obtain the size of the adapter list and routing table, also allocate memory */ @@ -852,9 +852,10 @@ static struct hostent *get_local_ips( char *hostname ) } if (exists) continue; - route_addrs = realloc( route_addrs, (numroutes + 1) * sizeof(struct route) ); - if (!route_addrs) + new_route_addrs = realloc( route_addrs, (numroutes + 1) * sizeof(struct route) ); + if (!new_route_addrs) goto cleanup; + route_addrs = new_route_addrs; route_addrs[numroutes].interface = ifindex; route_addrs[numroutes].metric = ifmetric; route_addrs[numroutes].default_route = ifdefault;
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ws2_32/unixlib.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/ws2_32/unixlib.c b/dlls/ws2_32/unixlib.c index 56a0bed308d..b79d6e5b8cf 100644 --- a/dlls/ws2_32/unixlib.c +++ b/dlls/ws2_32/unixlib.c @@ -865,7 +865,10 @@ static NTSTATUS unix_gethostbyaddr( void *args ) }
if (!unix_host) + { + free( unix_buffer ); return (locerr < 0 ? errno_from_unix( errno ) : host_errno_from_unix( locerr )); + }
ret = hostent_from_unix( unix_host, params->host, params->size );
@@ -915,7 +918,10 @@ static NTSTATUS unix_gethostbyname( void *args ) }
if (!unix_host) + { + free( unix_buffer ); return (locerr < 0 ? errno_from_unix( errno ) : host_errno_from_unix( locerr )); + }
ret = hostent_from_unix( unix_host, params->host, params->size );