Fix some memory issues
Specifically:
- Fix a possible use-after-free:
If
g_mapped_file_new fails
, thenversion
will be freed, but it was already added to the hash table. This means there could be a use-after-free while doing a lookup on the hash table the next time. - Fix possible leak of transitive dependency name:
If a transitive dependency appears twice, the original pointer will be
removed from the hash table. Since these names were created by
g_strsplit
, they need to be freed, or they will leak.