struct pakfire_db* db;
int r;
+ // Initialize the pool
+ Pool* pool = pakfire->pool = pool_create();
+ pool_setdisttype(pool, DISTTYPE_RPM);
+
+#ifdef SOLVER_DEBUG
+ pool_setdebuglevel(pool, 1);
+#endif
+
+ // Set architecture of the pool
+ pool_setarch(pool, pakfire->arch);
+
// Open database in read-only mode and try to load all installed packages
r = pakfire_db_open(&db, pakfire, PAKFIRE_DB_READWRITE);
if (r)
private_dir, strerror(errno));
free(private_dir);
- pakfire_free(p);
- return r;
+ goto ERROR;
}
- // Initialize the pool
- p->pool = pool_create();
- pool_setdisttype(p->pool, DISTTYPE_RPM);
-
-#ifdef SOLVER_DEBUG
- pool_setdebuglevel(p->pool, 1);
-#endif
-
- // Set architecture of the pool
- pool_setarch(p->pool, p->arch);
-
// Populate pool
r = pakfire_populate_pool(p);
- if (r) {
- pakfire_free(p);
-
- return r;
- }
+ if (r)
+ goto ERROR;
// Initialise cache
pakfire_set_cache_path(p, CACHE_PATH);
*pakfire = p;
return 0;
+
+ERROR:
+ pakfire_free(p);
+
+ return r;
}
PAKFIRE_EXPORT Pakfire pakfire_ref(Pakfire pakfire) {