diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-16 22:27:30 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-16 22:27:30 +0900 |
commit | cd86deefa141b719cde080146ed6027fa0786a52 (patch) | |
tree | 72865b49f5c028355c774a61b32219736c35304f /src/test/test-prioq.c | |
parent | d13b5f5a85f6070586e59f6dd2a8b2c9358d5c7e (diff) | |
download | systemd-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.c | 3 |
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; |