Fix attempt to parse trailing junk on a line as a valid option, by
checking for characters we know will be in any valid options string.

Fix attempt to free() a pointer not allocated by malloc()

This runs OK now, but generates a lot of 'duplicate option' messages,
which are pretty pointless as the way the metadata is generated and
parsed means that every option is going to be duplicated.