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.
Merge pull request #462 from kAworu/master

Fix a panic when pkg add'ing a package already installed.
Add RET0_IF_ALREADY_INSTALLED option to allow better scripting integration.

When this option is enabled, `pkg install' should exits 0 when the
package(s) is/are already installed.
`pkg install' now honor the RET0_IF_ALREADY_INSTALLED option.