From: Thierry Reding <tred...@nvidia.com>

The array subscription operator ([]) has higher precedence than the
indirection operator (*), so we need to use parentheses to properly
instruct the compiler to dereference the pointer to an array first,
and then subscript into the array.

Fixes a crash observed on Tegra.

Signed-off-by: Thierry Reding <tred...@nvidia.com>
---
 xf86drm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index d006bb38f800..5de37083c9a3 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3606,14 +3606,14 @@ static int drmParseOFDeviceInfo(int maj, int min, char 
***compatible)
             free(value);
         }
 
-        *compatible[i] = tmp_name;
+        (*compatible)[i] = tmp_name;
     }
 
     return 0;
 
 free:
     while (i--)
-        free(*compatible[i]);
+        free((*compatible)[i]);
 
     free(*compatible);
     return err;
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to