[Spice-devel] [PATCH] quic: Fix test which is always true

Christophe Fergeau cfergeau at redhat.com
Mon Jan 20 03:11:46 PST 2014


find_model_params() is first doing *nbuckets = 0; and it then checks
nbuckets for NULL. This is redundant as the dereferencing would a segfault,
so the if (nbuckets) test can't be false.
As Uri pointed out, the "/* bucket start */" comment on the same line
probably implies that the test was meant to be 'if (*nbuckets)'
I've ran a few test and I did not observe issues because of it...
---
 common/quic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/quic.c b/common/quic.c
index bcbf093..29459bc 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -952,7 +952,7 @@ static void find_model_params(Encoder *encoder,
     bsize = *firstsize;
 
     do { /* other buckets */
-        if (nbuckets) {         /* bucket start */
+        if (*nbuckets) {         /* bucket start */
             bstart = bend + 1;
         } else {
             bstart = 0;
-- 
1.8.4.2



More information about the Spice-devel mailing list