xbps_repository_pool_init: make registered index arrays immutable.

This commit is contained in:
Juan RP 2012-01-21 10:20:45 +01:00
parent 6417119aed
commit 1781231454

View File

@ -66,6 +66,7 @@ int HIDDEN
xbps_repository_pool_init(struct xbps_handle *xhp) xbps_repository_pool_init(struct xbps_handle *xhp)
{ {
prop_dictionary_t d = NULL; prop_dictionary_t d = NULL;
prop_array_t array;
size_t i, ntotal = 0, nmissing = 0; size_t i, ntotal = 0, nmissing = 0;
const char *repouri; const char *repouri;
char *plist; char *plist;
@ -122,15 +123,20 @@ xbps_repository_pool_init(struct xbps_handle *xhp)
free(plist); free(plist);
goto out; goto out;
} }
if (!xbps_add_obj_to_dict(d, array = prop_array_internalize_from_zfile(plist);
prop_array_internalize_from_zfile(plist), if (array == NULL) {
"index")) {
rv = EINVAL; rv = EINVAL;
prop_object_release(d); prop_object_release(d);
free(plist); free(plist);
goto out; goto out;
} }
free(plist); free(plist);
prop_array_make_immutable(array);
if (!xbps_add_obj_to_dict(d, array, "index")) {
rv = EINVAL;
prop_object_release(d);
goto out;
}
if (!prop_array_add(xhp->repo_pool, d)) { if (!prop_array_add(xhp->repo_pool, d)) {
rv = EINVAL; rv = EINVAL;
prop_object_release(d); prop_object_release(d);