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:
@ -296,5 +296,6 @@ main(int argc, char **argv)
|
||||
rv = show_pkg_revdeps(&xh, pkg, repo_mode);
|
||||
}
|
||||
|
||||
xbps_end(&xh);
|
||||
exit(rv);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2008-2014 Juan Romero Pardines.
|
||||
* Copyright (c) 2008-2015 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -230,13 +230,16 @@ search_repo_cb(struct xbps_repo *repo, void *arg, bool *done _unused)
|
||||
{
|
||||
xbps_array_t allkeys;
|
||||
struct search_data *sd = arg;
|
||||
int rv;
|
||||
|
||||
if (repo->idx == NULL)
|
||||
return 0;
|
||||
|
||||
sd->repourl = repo->uri;
|
||||
allkeys = xbps_dictionary_all_keys(repo->idx);
|
||||
return xbps_array_foreach_cb(repo->xhp, allkeys, repo->idx, search_array_cb, sd);
|
||||
rv = xbps_array_foreach_cb(repo->xhp, allkeys, repo->idx, search_array_cb, sd);
|
||||
xbps_object_release(allkeys);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -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
|
||||
@ -85,5 +85,6 @@ show_pkg_revdeps(struct xbps_handle *xhp, const char *pkg, bool repomode)
|
||||
xbps_array_get_cstring_nocopy(revdeps, i, &pkgdep);
|
||||
printf("%s\n", pkgdep);
|
||||
}
|
||||
xbps_object_release(revdeps);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user