Improve xbps_end() and use it before exit(3)ing.
- Simplify xbps_repo_open::repo_get_dict(). - Use xbps_end() in the utils where necessary. - Make xbps_end() call xbps_pkgdb_unlock() if necessary. - Make xbps_end() release rpool resources. - Make xbps_end() release resources from xbps_handle. - Fixed 90% of reported leaks (still reachable at exit) from valgrind. That was to silence valgrind's memcheck with --leak-check=full.
This commit is contained in:
16
lib/rpool.c
16
lib/rpool.c
@@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2014 Juan Romero Pardines.
|
||||
* Copyright (c) 2009-2015 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -91,6 +91,20 @@ xbps_rpool_get_repo(const char *url)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
xbps_rpool_release(struct xbps_handle *xhp _unused)
|
||||
{
|
||||
struct xbps_repo *repo;
|
||||
|
||||
while ((repo = SIMPLEQ_FIRST(&rpool_queue))) {
|
||||
SIMPLEQ_REMOVE(&rpool_queue, repo, xbps_repo, entries);
|
||||
xbps_repo_close(repo, true);
|
||||
free(repo);
|
||||
}
|
||||
if (xhp->repositories)
|
||||
xbps_object_release(xhp->repositories);
|
||||
}
|
||||
|
||||
int
|
||||
xbps_rpool_foreach(struct xbps_handle *xhp,
|
||||
int (*fn)(struct xbps_repo *, void *, bool *),
|
||||
|
||||
Reference in New Issue
Block a user