James Hawkins truiken@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.