lib/pkgdb_conversion.c: avoid copying dangling pointer if "repository-origin" is unexistent.

This commit is contained in:
Juan RP 2014-09-13 16:59:19 +02:00
parent d67f8bdc8c
commit b42c3d8498

View File

@ -76,9 +76,10 @@ pkgdb038(struct xbps_handle *xhp, const char *opkgdb_plist)
* Rename "repository-origin" obj to "repository" to match
* the repository index obj.
*/
xbps_dictionary_get_cstring_nocopy(pkgd, "repository-origin", &repo);
xbps_dictionary_set_cstring(pkgd, "repository", repo);
xbps_dictionary_remove(pkgd, "repository-origin");
if (xbps_dictionary_get_cstring_nocopy(pkgd, "repository-origin", &repo)) {
xbps_dictionary_set_cstring(pkgd, "repository", repo);
xbps_dictionary_remove(pkgd, "repository-origin");
}
/*
* Copy old pkgdb objects to the new pkgdb.
*/