xbps_remove_pkg: do not pass dangling pointers to state cb after removing pkgdict.

This commit is contained in:
Juan RP 2012-07-04 09:52:51 +02:00
parent f1ad8a95de
commit abdf6e710d
2 changed files with 14 additions and 2 deletions

5
NEWS
View File

@ -1,3 +1,8 @@
xbps-0.16.2 (???):
* libxbps: after removing a pkg the state cb was passing dangling pointers in
its pkgname and version members.
xbps-0.16.1 (2012-06-30):
* xbps-repo(8): fixed a regression in the 'genindex' target. It was looking

View File

@ -271,7 +271,8 @@ xbps_remove_pkg(struct xbps_handle *xhp,
bool soft_replace)
{
prop_dictionary_t pkgd = NULL;
char *buf = NULL, *pkgver = NULL;
char *tmpname = NULL, *buf = NULL, *pkgver = NULL;
const char *tmpver = NULL;
int rv = 0;
bool rmfile_exists = false;
pkg_state_t state = 0;
@ -438,8 +439,14 @@ purge:
if ((rv = xbps_unregister_pkg(xhp, pkgname, version, false)) != 0)
goto out;
tmpname = xbps_pkg_name(pkgver);
assert(tmpname);
tmpver = xbps_pkg_version(pkgver);
assert(tmpver);
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_DONE,
0, pkgname, version, NULL);
0, tmpname, tmpver, NULL);
free(tmpname);
out:
if (buf != NULL)