https://github.com/OpenImageIO/oiio/pull/448
On Oct 30, 2012, at 10:53 AM, Larry Gritz wrote:
> Thanks for pointing that out.
>
> Yes, in fact there are also several places in TGAOutput::open() where the
> file handle is not properly closed.
>
> Sounds easy to fix. Stay tuned for a pull request from me.
>
>
>
> On Oct 30, 2012, at 10:39 AM, Nicolas Burtnyk wrote:
>
>> While testing OIIO, I noticed that TGAs that were being written to
>> disk were not being closed despite calling ImageOutput::close().
>> Indeed fclose is not called in TGAOutput::close when the "Artist"
>> attribute is empty.
>> The problematic block of code is:
>>
>> if (!fwrite (tmpstr.c_str(), std::min (tmpstr.length (), size_t(40)))) {
>> return false;
>> }
>>
>> Since tmpstr is empty, the itemsize parameter of fwrite is 0 and
>> fwrite returns false, which in turn makes TGAOutput::close early
>> return false (skipping the call to fclose).
>>
>> Writing of other string attributes are similarly problematic when the
>> attribute is empty.
>>
>> -Nicolas
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org