create_verbose_row: free malloc'd strings

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
restrict transaction package origins

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
avoid double freeing unresolvable packages

If an unresolvable package was loaded from a file it would be free'd
again when freeing trans->add.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
_alpm_sync_prepare: fix unresolvable packages leak

If the user opted not to remove the unresolvable packages from the
transaction, the list wasn't saved to the transaction to be free'd in
trans_release.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
local_db_populate: initialize empty pkgcache

If the db directory did not exist when local_db_populate was called, the
pkgcache wouldn't be initialized, causing pkghash_add_pkg to fail.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
dump_pkg_full: fix optionalfor memory leak

alpm_pkg_compute_optional returns a generated list that needs to be
free'd.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
sync_prepare: manually set pm_errno

_alpm_resolvedeps resets pm_errno to 0 by calling alpm_checkdeps.
Whenever the last call succeeded, pm_errno was not properly set,
preventing pacman from properly handling the error and leaking
additional memory.  We know pm_errno should be ALPM_ERR_UNSATISFIED_DEPS
if resolvedeps has failed, so just set it manually.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
_alpm_resolvedeps: free targ inside loop

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
table_display: free memory on errors

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
alpm: export *_free functions

Front-ends should be able to free memory that alpm hands them.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>