nouveau: fix nouveau_scratch_runout_release bo count underflow
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 5 May 2012 11:28:19 +0000 (13:28 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sun, 6 May 2012 20:03:06 +0000 (22:03 +0200)
src/gallium/drivers/nouveau/nouveau_buffer.c

index 369492de3170840b1f8fbf2660798b3c3c1544e8..f6629901c155b139c5c1892b7856d11aef88df1f 100644 (file)
@@ -524,8 +524,10 @@ nouveau_scratch_runout_release(struct nouveau_context *nv)
 {
    if (!nv->scratch.nr_runout)
       return;
-   while (nv->scratch.nr_runout--)
+   do {
+      --nv->scratch.nr_runout;
       nouveau_bo_ref(NULL, &nv->scratch.runout[nv->scratch.nr_runout]);
+   } while (nv->scratch.nr_runout);
 
    FREE(nv->scratch.runout);
    nv->scratch.end = 0;