summaryrefslogtreecommitdiff
path: root/src/test/test-prioq.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-16 22:27:30 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-10-16 22:27:30 +0900
commitcd86deefa141b719cde080146ed6027fa0786a52 (patch)
tree72865b49f5c028355c774a61b32219736c35304f /src/test/test-prioq.c
parentd13b5f5a85f6070586e59f6dd2a8b2c9358d5c7e (diff)
downloadsystemd-cd86deefa141b719cde080146ed6027fa0786a52.tar.gz
systemd-cd86deefa141b719cde080146ed6027fa0786a52.tar.bz2
systemd-cd86deefa141b719cde080146ed6027fa0786a52.zip
util: fix segfault in prioq_remove() with empty Prioq object
Diffstat (limited to 'src/test/test-prioq.c')
-rw-r--r--src/test/test-prioq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/test-prioq.c b/src/test/test-prioq.c
index 8aff66978e..b2ee70bca6 100644
--- a/src/test/test-prioq.c
+++ b/src/test/test-prioq.c
@@ -86,6 +86,7 @@ static void test_struct(void) {
while ((t = set_steal_first(s))) {
assert_se(prioq_remove(q, t, &t->idx) == 1);
assert_se(prioq_remove(q, t, &t->idx) == 0);
+ assert_se(prioq_remove(q, t, NULL) == 0);
free(t);
}
@@ -94,6 +95,8 @@ static void test_struct(void) {
assert_se(prioq_size(q) == (SET_SIZE * 3 / 4) - i);
assert_se(t = prioq_pop(q));
+ assert_se(prioq_remove(q, t, &t->idx) == 0);
+ assert_se(prioq_remove(q, t, NULL) == 0);
assert_se(previous <= t->value);
previous = t->value;