aboutsummaryrefslogtreecommitdiff
path: root/tests/test-throttle.c
diff options
context:
space:
mode:
authorAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>2019-07-30 19:01:36 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2019-08-20 17:26:19 +0200
commitef0aa6af47da16f5367f545deb599a14ea408bee (patch)
tree17ae49c4d84415ace1ba6322792143e6985b3e44 /tests/test-throttle.c
parentde428cead63a958137ee63efcc3cceaf75f6c125 (diff)
downloadqemu-ef0aa6af47da16f5367f545deb599a14ea408bee.zip
qemu-ef0aa6af47da16f5367f545deb599a14ea408bee.tar.gz
qemu-ef0aa6af47da16f5367f545deb599a14ea408bee.tar.bz2
test-throttle: Fix uninitialized use of burst_length
ThrottleState::cfg of the static variable 'ts' is reassigned with the local one in the do_test_accounting() and then is passed to the throttle_account() with uninitialized member LeakyBucket::burst_length. Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Message-Id: <1564502498-805893-2-git-send-email-andrey.shinkevich@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/test-throttle.c')
-rw-r--r--tests/test-throttle.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 083e1f9..7adb5e6 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -558,6 +558,8 @@ static bool do_test_accounting(bool is_ops, /* are we testing bps or ops */
BucketType index;
int i;
+ throttle_config_init(&cfg);
+
for (i = 0; i < 3; i++) {
BucketType index = to_test[is_ops][i];
cfg.buckets[index].avg = avg;