[Libva] [PATCH] Fix while loop

Xiang, Haihao haihao.xiang at intel.com
Wed Nov 26 00:41:27 PST 2014


Otherwise i may be 32 after enter the loop and access
dri_state->drawable_hash[32].

Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 va/x11/va_dricommon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/va/x11/va_dricommon.c b/va/x11/va_dricommon.c
index c0cbbcc..379e3d4 100644
--- a/va/x11/va_dricommon.c
+++ b/va/x11/va_dricommon.c
@@ -86,11 +86,12 @@ free_drawable(VADriverContextP ctx, struct dri_drawable* dri_drawable)
     struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     int i = 0;
 
-    while (i++ < DRAWABLE_HASH_SZ) {
+    while (i < DRAWABLE_HASH_SZ) {
 	if (dri_drawable == dri_state->drawable_hash[i]) {
 	    dri_state->destroyDrawable(ctx, dri_drawable);
 	    dri_state->drawable_hash[i] = NULL;
 	}
+	i++;
     }
 }
 
-- 
1.9.1



More information about the Libva mailing list