Boost logo

Boost :

Subject: Re: [boost] [filesystem] resize_file_api leaks a HANDLE
From: Beman Dawes (bdawes_at_[hidden])
Date: 2014-12-30 10:56:54


On Tue, Dec 30, 2014 at 8:40 AM, Peter Dimov <lists_at_[hidden]> wrote:

> ... when SetFilePointerEx or SetEndOfFile fails.
>
> BOOL resize_file_api(const wchar_t* p, boost::uintmax_t size)
> {
> HANDLE handle = CreateFileW(p, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
> FILE_ATTRIBUTE_NORMAL, 0);
> LARGE_INTEGER sz;
> sz.QuadPart = size;
> return handle != INVALID_HANDLE_VALUE
> && ::SetFilePointerEx(handle, sz, 0, FILE_BEGIN)
> && ::SetEndOfFile(handle)
> && ::CloseHandle(handle);
> }
>

 That's ticket #6945. Fixed in develop by applying patch from Kaylyn Bogle.
Fix should ship with 1.58.0

Thanks,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk