[PATCH 5/6] kernel32: Fix an off-by-one error.

James Hawkins truiken at gmail.com
Tue Mar 24 17:51:46 CDT 2009


On Tue, Mar 24, 2009 at 3:50 PM, Alexandre Julliard <julliard at winehq.org> wrote:
> James Hawkins <truiken at gmail.com> writes:
>
>>> This cannot be right. What happens to the original first_section then?
>>>
>>
>> I don't really understand your question.  By original first_section,
>> do you mean the first_section that we loaded from an existing file or
>> that is in the cache?  If so, then the answer is that the cache is
>> cleared when the file is re-read.  That doesn't really seem like what
>> you're asking though.  next_section is just a poorly worded name for a
>> list iterator which starts at the first section and loads all of the
>> sections into the file.  Without this fix, the first section is loaded
>> as a blank section and the real first section starts second in the
>> linked list.  After all of the loading is done, the first_section is
>> returned to the caller.
>
> Yes, the first section is empty, it's supposed to hold keys that appear
> before the first section header (if any). With your patch it will simply
> be dropped (and leaked). A better patch would be to only create the
> first section as needed, when we encounter either a section header or a
> stand-alone key.
>

Ah ok, I didn't know about that functionality.  I will add more tests
and a better fix.

-- 
James Hawkins



More information about the wine-devel mailing list