Compare commits

...

5 Commits

Author SHA1 Message Date
Dylan Baker 0c72b7cd41 ci: run meson test with the address sanitizer enabled
Set the ASAN_OPTION so that the exitcode is not 1, this avoids asan
returning the exitcode that the tests already expect from a normal
pkgconf error
2022-08-02 09:58:56 -07:00
Dylan Baker c7b0f86815 cache: set the cache_table to NULL if empty
Instead of realloc'ing to a size of 0, set the cache_table to NULL when
removing the last element from it.
2022-08-02 09:58:56 -07:00
Dylan Baker d23dc2c183 cache: don't try to remove packages from the cache if it's NULL
Otherwise we end up reallocing the cache_table, when we shouldn't
2022-08-02 09:58:56 -07:00
Dylan Baker a620e62286 cache: unref the package when removing it from the cache 2022-08-02 09:58:56 -07:00
Dylan Baker 36acd2e409 queue: don't collect static dependencies unless that's what we're looking for
Currently the required_private field gets walked twice, once when the
main required field is walked, and a second time when it is walked
itself. This results in the requires_private field leaking memory.
2022-08-02 09:58:06 -07:00
4 changed files with 62 additions and 12 deletions

View File

@ -60,6 +60,30 @@ jobs:
run: |
meson test -v -C _build
debian-meson-asan:
runs-on: ubuntu-latest
container:
image: debian:testing
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update system and add dependencies
run: |
apt-get update
apt-get install -y kyua atf-sh build-essential meson
- name: Build
run: |
meson _build -Db_sanitize=address
meson compile -C _build
- name: Run tests
run: |
meson test -v -C _build
env:
ASAN_OPTIONS: "exitcode=7"
debian-autotools:
runs-on: ubuntu-latest
container:

View File

@ -12,6 +12,21 @@ pipeline:
IMAGE: debian
BUILD: meson
debian-meson-asan:
image: debian:testing
environment:
- ASAN_OPTIONS="exitcode=7"
commands:
- apt-get update
- apt-get install -y kyua atf-sh build-essential meson
- meson _build -Db_sanitize=address
- meson compile -C _build
- meson test -v -C _build
when:
matrix:
IMAGE: debian
BUILD: meson
debian-autotools:
image: debian:testing
commands:

View File

@ -153,6 +153,9 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
if (pkg == NULL)
return;
if (client->cache_table == NULL)
return;
if (!(pkg->flags & PKGCONF_PKG_PROPF_CACHED))
return;
@ -168,6 +171,7 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
return;
pkg->flags &= ~PKGCONF_PKG_PROPF_CACHED;
pkgconf_pkg_unref(client, pkg);
*slot = NULL;
qsort(client->cache_table, client->cache_count,
@ -182,8 +186,11 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
}
client->cache_count--;
client->cache_table = pkgconf_reallocarray(client->cache_table,
client->cache_count, sizeof(void *));
if (client->cache_count == 0)
client->cache_table = NULL;
else
client->cache_table = pkgconf_reallocarray(client->cache_table,
client->cache_count, sizeof(void *));
}
/*

View File

@ -116,22 +116,26 @@ pkgconf_queue_collect_dependents(pkgconf_client_t *client, pkgconf_pkg_t *pkg, v
if (pkg == world)
return;
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
{
pkgconf_dependency_t *flattened_dep;
if ((pkg->flags & PKGCONF_PKG_PROPF_STATIC) == PKGCONF_PKG_PROPF_STATIC) {
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
{
pkgconf_dependency_t *flattened_dep;
flattened_dep = pkgconf_dependency_copy(client, node->data);
flattened_dep = pkgconf_dependency_copy(client, node->data);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private);
}
}
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
else
{
pkgconf_dependency_t *flattened_dep;
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
{
pkgconf_dependency_t *flattened_dep;
flattened_dep = pkgconf_dependency_copy(client, node->data);
flattened_dep = pkgconf_dependency_copy(client, node->data);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required);
}
}
}