Commit 5b0430a1 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

dnsapi: Free the buffer in the early return paths.

parent 55b3e609
...@@ -192,11 +192,16 @@ static NTSTATUS resolv_get_serverlist( void *args ) ...@@ -192,11 +192,16 @@ static NTSTATUS resolv_get_serverlist( void *args )
if (filter( buf[i].sin.sin_family, params->family )) continue; if (filter( buf[i].sin.sin_family, params->family )) continue;
found++; found++;
} }
if (!found) return DNS_ERROR_NO_DNS_SERVERS; if (!found)
{
free( buf );
return DNS_ERROR_NO_DNS_SERVERS;
}
needed = FIELD_OFFSET(DNS_ADDR_ARRAY, AddrArray[found]); needed = FIELD_OFFSET(DNS_ADDR_ARRAY, AddrArray[found]);
if (!addrs || *params->len < needed) if (!addrs || *params->len < needed)
{ {
free( buf );
*params->len = needed; *params->len = needed;
return !addrs ? ERROR_SUCCESS : ERROR_MORE_DATA; return !addrs ? ERROR_SUCCESS : ERROR_MORE_DATA;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment